cancel
Showing results for 
Search instead for 
Did you mean: 

Confusion on the VL53L1-SATEL registers

Carson
Associate III

Hello, I am currently trying to write code for the I2C communication with the VL53L1-SATEL board. I was trying to confirm that the I2C was working by reading some registers mentioned in the VL53L1 Datasheet, those being 0xC0, 0xC1, 0xC2, 0x51, and 0x61. I was never able to get actual data from these registers. I have since found some example code that when I run I am able to read distance but when I try to read those registers in the example code I still am unable to get any of the data that is meant to be in those registers and some I get just zero while others I get the wrong values. I am wondering if the info in the datasheet about those registers is wrong or if I am doing something wrong along the way. A important note is that I am also reading from 0x010F using the same command which outputs 234, 0xEA in hex, but I am unable to see anywhere if that info is right or wrong. 

 

Thanks, 

Carson

4 REPLIES 4
John_Kvam
Senior

Here is how do do this the easy way. 

first buy the Nucleo-F401RE - they are very inexpensive. Somethiing like $10 depending on who you buy them from.

Then - using jumper wires - wire up the satel board. 

Download the VL53L1 ULD (ultra light driver) along with the Evaluation code. 

Use the eval code to prove your wiring all works. 

Then build the example code in the ULD driver and give that a shot. You will need the Developement environemnt - but it's free from ST - just like the Eval software and the ULD driver itself.

Once you get the example code in the driver working, insert some code in the I2C_read and I2c_write functions. 

If you are clever you can also put print statements into the VL53 functions so you end up with The function, and the resulting I2C writes and reads. 

From there everything should make sense and you've only invested $10 and some time. 

Good luck, 

- john

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.

At this point I have the breakout board working completely, but still get no information from the registers mentioned in the datasheet. So I'm just confused why I get no info from those but the board works fine. No complication with setting it up right. 

Zhiyuan.Han
ST Employee

Hi 

if you just want to confirm if I2C read/write is correct, you can use below code for function check. 

 

For read/write function check: 
 
 
uint8_t byteData;
uint16_t wordData;
uint32_t DwordData;
uint8_t test_buffer_write[4]={0x5A,0xA5,0XAA,0x55};
uint8_t test_buffer_read[4];
 
 
VL53L1_RdByte(Dev, 0x010F, &byteData);
printf("VL53L1X Model_ID: %02X\n\r", byteData);
VL53L1_RdByte(Dev, 0x0110, &byteData);
printf("VL53L1X Module_Type: %02X\n\r", byteData);
VL53L1_RdWord(Dev, 0x010F, &wordData);
printf("VL53L1X: %02X\n\r", wordData);
 
VL53L1_WrWord(Dev, 0x0016, 0x5AA5);
VL53L1_RdWord(Dev, 0x0016, &wordData);
printf("Write 0x5AA5, read value: %02X\n\r", wordData);
 
VL53L1_WrDWord(Dev, 0x0016, 0x5AA5AA55);
VL53L1_RdDWord(Dev, 0x0016, &DwordData);
printf("Write 0x5AA5AA55, read value: %02X\n\r", DwordData);
 
 
VL53L1_WriteMulti(Dev, 0x0016, test_buffer_write,4);
VL53L1_ReadMulti(Dev, 0x0016, test_buffer_read,4);
printf("WriteMulti 4 byte: 0x5AA5AA55\n\r");
printf("ReadMulti 0: %02X\n\r", test_buffer_read[0]);
printf("ReadMulti 1: %02X\n\r", test_buffer_read[1]);
printf("ReadMulti 2: %02X\n\r", test_buffer_read[2]);
printf("ReadMulti 3: %02X\n\r", test_buffer_read[3]);
 
 
Log list as below from Nucleo:
 
 
VL53L1X Model_ID: EA
VL53L1X Module_Type: CC
VL53L1X: EACC
Write 0x5AA5, read value: 5AA5
Write 0x5AA5AA55, read value: 5AA5AA55
WriteMulti 4 byte: 0x5AA5AA55
ReadMulti 0: 5A
ReadMulti 1: A5
ReadMulti 2: AA
ReadMulti 3: 55
 
 
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.
Carson
Associate III

Sorry let me be more specific. I know that my i2c read and write works, I can get accurate distance data from the board and properly configure the board. My specific question is why the registers mentioned in the datasheet: 0xC0, 0xC1, 0xC2, 0x51, and 0x61, don't output the value that is stated in the datasheet after I do a reset.