I have one VL53L0X ranging sensor that works fine with the ST library.
I performed the sensor configuration and I can read data form sensor.
Now I should add a second ranging sensor on the same I2C bus.
To change the address I perform this step:
- Sensor power on. Set to high the XSHUT pin.
- Change the address with the code below. The function returns VL53L0X_ERROR_NONE.
- Initialise the sensor, using the new address --> This step fails.
This is the code to change the I2C address:
newAddr &= 0x7F;
if( VL53L0X_SetDeviceAddress(&RANGING_SENSOR_VL53L0X_Handler[idSensor].handler, newAddr * 2) == VL53L0X_ERROR_NONE )
/* Store the new 7-bit address */
RANGING_SENSOR_VL53L0X_Handler[idSensor].handler.I2cDevAddr = newAddr;
Is this the correct sequence to change the I2C address?
Why I cannot communicate with the sensor using the new address?
Thanks for the help!