adafruit / Adafruit_VL53L1X

Arduino library to support the VL53L1X Time-of-Flight and gesture-detection sensor
BSD 3-Clause "New" or "Revised" License
13 stars 6 forks source link

Not using XSHUT pin causes non-responsive VL53L1X because of changed I2C address #4

Open mirzafahad opened 2 years ago

mirzafahad commented 2 years ago

I wanted to save a pin by not using the shutdown pin. And I noticed every time I uploaded the code the MCU was unable to communicate with the VL53L1X. And I needed to power cycle to make it work.

After some investigation, I realized the address of the device is changed inside Adafruit_VL53L1X::begin (line 64):

vl_status = InitSensor(i2c_addr * 2);

So if I don't use the shutdown pin, but reset the MCU, the MCU tries to find VL53L1X using the default address, but resetting MCU doesn't reset the VL53L1X, so it has the new address.

Why was the device address changed by default?

nsmith1024 commented 3 months ago

why is xshut needed? why dont they just use the two I2C pins like a normal human being?