Skip to main content
Visitor II
August 26, 2024
Solved

VL53L3CX i2c error (can't scan address)

  • August 26, 2024
  • 1 reply
  • 805 views

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.

Best answer by John E KVAM

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. 

1 reply

John E KVAM
John E KVAMBest answer
ST Employee
August 27, 2024

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.