cancel
Showing results for 
Search instead for 
Did you mean: 

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

Dg.1
Associate

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 !

1 ACCEPTED SOLUTION

Accepted Solutions
Zhiyuan.Han
ST Employee

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.

View solution in original post

1 REPLY 1
Zhiyuan.Han
ST Employee

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.