cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L5, data can't ready

Philister
Associate

Hardware environment: STM32F405 chip and VL53L5CX-SATEL module;

Software environment: Based on the STSW-IMG023 sample code, the code is ported to KEIL5 for use;

Problem description: After completing the sensor initialization (ranging frequency 10hz, ranging continuous mode), use polling to read data, call the vl53l5cx_check_data_ready function to read the sensor data: 0x00, 0x03, 0x01, 0x0D, these four values ​​are considered data not ready after judgment.

I want to know what these four values ​​mean? I checked the documents I know (DS13754, um2884, etc.) and did not find the relevant register description.

Why does this happen, and how should I debug?

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Zhiyuan.Han
ST Employee

Hi Philister

 

About your issue, I suggest checking the I2C link instead of the 4 registers meaning. 

can you share you schematic, and platform file which realize the I2C read/write function, 

  • Has the status = vl53l5cx_is_alive(&Dev, &isAlive); check passed or not.
  • The otherthing is the multi  read and write function. can you try below code and share the log, we can check if the multi read/write function is correct or not. 

 

Below is example codes which can help you vefify the I2C RdMulti/WrMulti function:
 
uint8_t Data_write[4]={0x5A,0xA5,0xAA,0x55};
uint8_t Data_read[4]={0,0,0,0};
uint8_t Data_default[4]={0,0,0,0};
 
status = RdMulti(&(Dev.platform), 0x100, Data_default ,4);
 
printf("\n\n\nRead default value and save it at begging\n");
printf("Data_default (0x%x)\n", Data_default[0]);
printf("Data_default (0x%x)\n", Data_default[1]);
printf("Data_default (0x%x)\n", Data_default[2]);
printf("Data_default (0x%x)\n\n\n", Data_default[3]);
 
 
status =  WrMulti(&(Dev.platform), 0x100,  Data_write,4);
printf("Write value 0x5A A5 AA 55 \n\n\n");
 
status = RdMulti(&(Dev.platform), 0x100,Data_read ,4);
printf("Reading:\n");
printf("Data_read (0x%x)\n", Data_read[0]);
printf("Data_read (0x%x)\n", Data_read[1]);
printf("Data_read (0x%x)\n", Data_read[2]);
printf("Data_read (0x%x)\n\n\n", Data_read[3]);
 
status =  WrMulti(&(Dev.platform), 0x100, Data_default,4);
printf("Write back default value! \n\n\n");
 
status = RdMulti(&(Dev.platform), 0x100,Data_default ,4);
 
printf("Read value again to make sure default value was correct loaded \n");
printf("Data_default (0x%x)\n", Data_default[0]);
printf("Data_default (0x%x)\n", Data_default[1]);
printf("Data_default (0x%x)\n", Data_default[2]);
printf("Data_default (0x%x)\n\n\n", Data_default[3]);

 

 

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

2 REPLIES 2
Zhiyuan.Han
ST Employee

Hi Philister

 

About your issue, I suggest checking the I2C link instead of the 4 registers meaning. 

can you share you schematic, and platform file which realize the I2C read/write function, 

  • Has the status = vl53l5cx_is_alive(&Dev, &isAlive); check passed or not.
  • The otherthing is the multi  read and write function. can you try below code and share the log, we can check if the multi read/write function is correct or not. 

 

Below is example codes which can help you vefify the I2C RdMulti/WrMulti function:
 
uint8_t Data_write[4]={0x5A,0xA5,0xAA,0x55};
uint8_t Data_read[4]={0,0,0,0};
uint8_t Data_default[4]={0,0,0,0};
 
status = RdMulti(&(Dev.platform), 0x100, Data_default ,4);
 
printf("\n\n\nRead default value and save it at begging\n");
printf("Data_default (0x%x)\n", Data_default[0]);
printf("Data_default (0x%x)\n", Data_default[1]);
printf("Data_default (0x%x)\n", Data_default[2]);
printf("Data_default (0x%x)\n\n\n", Data_default[3]);
 
 
status =  WrMulti(&(Dev.platform), 0x100,  Data_write,4);
printf("Write value 0x5A A5 AA 55 \n\n\n");
 
status = RdMulti(&(Dev.platform), 0x100,Data_read ,4);
printf("Reading:\n");
printf("Data_read (0x%x)\n", Data_read[0]);
printf("Data_read (0x%x)\n", Data_read[1]);
printf("Data_read (0x%x)\n", Data_read[2]);
printf("Data_read (0x%x)\n\n\n", Data_read[3]);
 
status =  WrMulti(&(Dev.platform), 0x100, Data_default,4);
printf("Write back default value! \n\n\n");
 
status = RdMulti(&(Dev.platform), 0x100,Data_default ,4);
 
printf("Read value again to make sure default value was correct loaded \n");
printf("Data_default (0x%x)\n", Data_default[0]);
printf("Data_default (0x%x)\n", Data_default[1]);
printf("Data_default (0x%x)\n", Data_default[2]);
printf("Data_default (0x%x)\n\n\n", Data_default[3]);

 

 

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.

Hi Zhiyuan,

Thanks for your reply, you are right! I used LA to capture the I2C data and found that there was indeed a problem in the initialization process. The reading of a certain register was always 0, which did not match the expected value. After repeated reading, it timed out, but the program did not handle this erroneous return status. It continued to execute and returned an erroneous value when vl53l5cx_check_data_ready.