Skip to main content
Dg.1
Visitor II
June 5, 2023
Solved

Use of the VL53L0X with the nucleo-H7A3ZI-Q ( STM32H7A3ZIT6QU)

  • June 5, 2023
  • 1 reply
  • 1355 views

For a project i need to add the sensor VL53L0X to a program, i've found the Library for the sensor ( STSW-IMG005 ) i can compil the program with no error , but don't work , i'm pretty sure it's from the adaptation from the library to my STM32, if you have a similar case or can help me it will be appreciated !

This topic has been closed for replies.
Best answer by Zhiyuan.Han

Hi Associate

I suspect it was due to I2C function was not ported correctly, you can use below code do a I2C read/write function test to see if the I2C link is working fine. 

 

// . byte read/write test
VL53L0X_write_byte(0x52, 0x04, 0x5A);
VL53L0X_read_byte(0x52, 0x04, &byteData);
if( 0x5A != byteData )
{
// error
}
// . word read/write test
VL53L0X_write_word(0x52, 0x04, 0x5AA5);
VL53L0X_read_word(0x52, 0x04, &wordData);
if( 0x5AA5 != wordData ) // cut 1.1
{
// error
}
// . dword read/write test
VL53L0X_write_dword(0x52, 0x04, 0x5AA5AA55);
VL53L0X_read_dword(0x52, 0x04, &dwordData);
if( 0x5AA5AA55 != dwordData )
{
// error
}

Br

Zhiyuan.Han

 

1 reply

Zhiyuan.Han
Zhiyuan.HanBest answer
Technical Moderator
July 7, 2023

Hi Associate

I suspect it was due to I2C function was not ported correctly, you can use below code do a I2C read/write function test to see if the I2C link is working fine. 

 

// . byte read/write test
VL53L0X_write_byte(0x52, 0x04, 0x5A);
VL53L0X_read_byte(0x52, 0x04, &byteData);
if( 0x5A != byteData )
{
// error
}
// . word read/write test
VL53L0X_write_word(0x52, 0x04, 0x5AA5);
VL53L0X_read_word(0x52, 0x04, &wordData);
if( 0x5AA5 != wordData ) // cut 1.1
{
// error
}
// . dword read/write test
VL53L0X_write_dword(0x52, 0x04, 0x5AA5AA55);
VL53L0X_read_dword(0x52, 0x04, &dwordData);
if( 0x5AA5AA55 != dwordData )
{
// error
}

Br

Zhiyuan.Han

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.