cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L8CX no i2C connection

AA.16
Associate III

I have a VL53L8CX time of flight sensor connected via I2C on a custom board. The Board has other devices that can talk on I2C no problem.

 

now i cant see the i2c address of the ToF device.

 

from my understanding everything seems to be fine and in accordance with the datasheet.

 

However there are two things that might be not correct and i want to make sure that my assumptions are not wrong.

 

about the LPn pin (A2) in the datasheet this is written:

Enables communication. Drive this pin to logic 0
to disable I²C communication when the device is
in low-power mode. Drive this pin to logic 1 to
enable I²C communication in low-power mode.
This pin is typically used when you need to
change the I²C address in multidevice systems. If
it is not used, or if interfacing via the SPI,
connect to IOVDD with a 47 kΩ pullup resistor

 

I dont plan to use the low power i2c mode. so i connected it to IOVDD via a 47kohm resistor. Was this correct?

 

the other thing i am not sure about are these pins: SYNC, INT 

i was planning not to use them so i didnt connect them to anything. basically they are floating.

however for the INT pin it states:

Interrupt output, defaults to open drain output
(tristate), 47 kΩ pullup resistor to IOVDD required

so is it required to have the 47kohm even if you dont want to use the interrupt pin? Would that prevent the device address from showing up at all?

almost the same text is written for the SYNC pin:

General purpose I/O, defaults to open drain
output (tristate), 47 kΩ pullup resistor required to
IOVDD

TLDR:

i2c scanner does not show the ToF device. communication not possible.

i have two pins that i am not using and have left floating: INT and SYNC. 

 

i was using this datasheet: https://www.st.com/resource/en/datasheet/vl53l8cx.pdf

question: is this the reason why the device does not show up in a i2c address scan?

4 REPLIES 4
John E KVAM
ST Employee

When you say I2C scan, I'm guessing you have a linux based machine and are using something like i2cdetect? 

The sensor is a bit complex, but the I2C part of it is dead simple. If the sensor is powered on, and the LPn is high, and the I2C/SPI line is set correctly, you should get a response.

The INT is handy - you really should connect to something. Even if you don't use it now, maybe someday? Otherwise, you end up polling "are you done yet" and that uses a lot of bandwidth. 

you asked, "I don't plan to use the low power i2c mode. so i connected it (LPn) to IOVDD via a 47kohm resistor. Was this correct?" - YES it is. 

So with that pin high you should be talking. So that leaves power. Are those correct?

Put a scope on the SCL and SDA lines. You should get a response from 0x29. 

are C1 and C2 connected to GND. 

C1 - SPI_I2C_N Digital input
     I2C: connect to GND
     SPI: connect to IOVDD

C2 -  nCS Digital input
    I2C: connect to GND
    SPI: active low chip select

 


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

Hi John,

I have a similar question. I am using VL53L8 with ESP32C6 but cannot passs the I2C communication.  

The error shows: "
E (334) i2c.master: I2C transaction unexpected nack detected
E (344) i2c.master: s_i2c_synchronous_transaction(872): I2C transaction failed
E (354) i2c.master: i2c_master_transmit(1074): I2C transaction failed
E (354) i2c.master: I2C transaction unexpected nack detected
E (364) i2c.master: s_i2c_synchronous_transaction(872): I2C transaction failed
E (374) i2c.master: i2c_master_transmit_receive(1097): I2C transaction failed
E (384) i2c.master: I2C transaction unexpected nack detected
E (384) i2c.master: s_i2c_synchronous_transaction(872): I2C transaction failed
E (394) i2c.master: i2c_master_transmit_receive(1097): I2C transaction failed
E (404) i2c.master: I2C transaction unexpected nack detected
E (404) i2c.master: s_i2c_synchronous_transaction(872): I2C transaction failed
E (414) i2c.master: i2c_master_transmit(1074): I2C transaction failed
"

I am sure I had the correct connection between ESP32 and the sensor. Could you provide some suggestions based on this case? Thanks!

 

in a way, I2C errors are easy. It's probably a hardware fault. So, either your power is wrong, or the Xshut is wrong, your I2C lines are crossed or the I2C LPn is incorrectly set. 

But if all of that is good, we have to look toward power to the sensor. Get that wrong, and of course nothing will work. Double check your schematic to the one in the datasheet. 

If all of that is right, then we need to talk I2C address. The 0x29 is the base address. This is left shifted by 1 to get the write address of 0x52 and one adds 1 to get a read address of 0x53. 

The sensor is complex. After all, one has to download 80K bytes before you even start. And speaking of that...

If you get past the initial Chip ID, you start the download. And lots of processors so NOT have the ability to transmit 8K bytes. So if that is where you are failing you need to break those long writes into smaller chunks. 

It's been done before. Check GitHub.

- john


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
John E KVAM
ST Employee

It's not showing up because it's not powered up, or it's connected incorrectly.

LPn must be high. It doesn't care how you get it that way. Pull-up is fine. 

No interrupt connection is fine. But I'd recommend you connect it to an unused PIO. You might want it later. 

Sync pin is OK unconnected. You might have to send a Disable_Sync command after you get booted, but it will not affect your initial connection. 

None of what you have identified is what is killing you. 

Double check IOVDD. That's a biggie. Double check LPn. 

Double check your I2C lines. 

MCUs and CPUs generally have multiple I2C ports. Double check all the ports. Maybe you just missed the right one. 

- john


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.