Reputation: 427
As the title say, I'm trying to get the value from two vl53l0x sensors connected to a Raspberry Pi Zero W.
I wired all well and I tested the sensors one by one. They works well.
The problem is that when they are both connected to the I2C bus, I can't talk to them because they has the same default address 0x29 (checked using the following comand: sudo i2cdetect -y 1
)
I read the datasheet of the sensor and searched online for resources to understand how to change the sensor's register value that store the address. There's a specific way to do that as you can see here: AN4846 Application note from page 5.
And than I found this repository that I'm now using to achieve the objective.
But when I run the VL53L0X_multi_example.py I get this output
VL53L0X Start Ranging Address 0x2B
Setting I2C Address to 0x2B
Call of VL53L0X_SetAddress
API Status: -20 : Control Interface Error
VL53L0X Start Ranging Address 0x2D
Setting I2C Address to 0x2D
Call of VL53L0X_SetAddress
API Status: -20 : Control Interface Error
VL53L0X_BETTER_ACCURACY_MODE
Set Accuracy
API Status: -20 : Control Interface Error
VL53L0X_BETTER_ACCURACY_MODE
Set Accuracy
API Status: -20 : Control Interface Error
Timing 20 ms
1 - Error
2 - Error
...
Call of VL53L0X_StopMeasurement
API Status: -20 : Control Interface Error
Call of VL53L0X_StopMeasurement
API Status: -20 : Control Interface Error
I can't understand why this error (API Status: -20 : Control Interface Error), commented as
Error during interrupt clear
in the Api/core/inc/vl53l0x_def.h, is triggered. What is going wrong?
Upvotes: 1
Views: 2353
Reputation: 11
Okay, so VL53L0X has an option to set I2C address, and the documentation looks to newbies(like me) as if you could "flash" each L0X with different I2C addresses and the effect will be permanently on EEPROM somewhere. It is not. I2C addresses of VL53Lxx resets to the default upon a reset.
The way it works is by having XSHUT wired from uC to each L0X in such ways, e.g. through a 74LSxxx shift register, that after a system reset, host uC would enable and configure each L0X one by one, until all L0X on the bus is reset and configured so that they do not conflict and all XSHUT could be up.
Like, what? Datasheet sounds like GPIO1 pin is there to daisy-chain them, but that isn't how it's implemented.
Upvotes: 1