cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L3CX i2c error (can't scan address)

jhson0531
Associate

I'm using VL53L3CX. The development board is nucleo f103rb. Power was supplied from the laptop, and pin connections were the same as shown in the notes in the example code.(sensor - pololu / code - stm32arduino helloworld)
The sensor was powered to 3.3 V in the vin

At first, the data came out well. However, after several repeated measurements, suddenly there was a problem with "initsensor." The code has not progressed since "initsensor."

I2C was the problem. I tried to search the address with scanner code but it failed.

After removing the sensor and board from all power connections, I tried again after a lot of time, and it went intermittently and then it didn't. When I took SDA and SCL with my oscilloscope, the signal was caught only when it was intermittent and I stayed in HIGH state when it was not

I've been suffering from this issue for weeks. I wonder if the sensor is broken or if there's something wrong.

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

There is something wrong all right, but it's not your fault - or ST's. It's the I2C bus itself. That bus in simply not very good. 

What you are getting is 'bus held low' and it's caused by noise on the line. Either the sensor or the host as clocked a bit due to noise and now the devices are out of sync. 

One can fix it in software if you can toggle the clock line a few times. (Theoretically, you can need 9 clocks.)

But to fix the real problem one must mitigate the noise. 

And that is a lot of trial and error.

  • shorten the wires
  • use your scope to insure you have nice 0/1 transitions.
  • stronger pull-ups
  • more/stronger decoupling caps
  • Twisted pair

And the list goes on. 

But I generally go with shorter wires - just to prove the system works. 


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.

View solution in original post

1 REPLY 1
John E KVAM
ST Employee

There is something wrong all right, but it's not your fault - or ST's. It's the I2C bus itself. That bus in simply not very good. 

What you are getting is 'bus held low' and it's caused by noise on the line. Either the sensor or the host as clocked a bit due to noise and now the devices are out of sync. 

One can fix it in software if you can toggle the clock line a few times. (Theoretically, you can need 9 clocks.)

But to fix the real problem one must mitigate the noise. 

And that is a lot of trial and error.

  • shorten the wires
  • use your scope to insure you have nice 0/1 transitions.
  • stronger pull-ups
  • more/stronger decoupling caps
  • Twisted pair

And the list goes on. 

But I generally go with shorter wires - just to prove the system works. 


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.