2025-06-25 6:08 AM
I am using the VL53L4CD sensor with a nucleo board by using the API provided by ST.
By using the xshut pin and the API, I can change the device address.
But as soon as I shut down the power or reset the sensor through xshut, its address comes back to the default one.
Am I doing something wrong?
If not, is there any way to save the new address in non-volatile way?
2025-06-25 8:08 AM
You are doing nothing wrong. That address change is volatile and as soon as you reboot - it goes back to original. In fact, the entire chip has no memory. Every reboot is its own adventure.
So, if you have multiple chips - the only reason to the address change - build the address change logic into your start up sequence and run that every time you reboot.
- john
2025-06-25 8:12 AM
So tu run N sensors I always needs 2 (i2c) + N (xshut) wires, right?
2025-06-25 8:29 AM
No. You can chain all the devices on the same i2C bus.
Then you need one GPIO for each of the XShut pins.
You might consider using an additional GPIO as an interrupt, but you can poll the chip as well. - so this is optional.
But if your MCU has multiple I2C busses - many of them do - you can hook one VL53 to one bus, and one VL53 on the other bus, then simply change which bus you are talking on.
It saves you having to change the address but limits you to two devices.