cancel
Showing results for 
Search instead for 
Did you mean: 

How to troubleshoot I2C bus sensor response problem?

FPayn.1
Associate III

I have a project where I am attempting to use six ST Microelectronics VL53L0X Time-of-Flight (ToF) sensors grouped into two 3-element arrays for position/orientation sensing on an autonomous wall-following robot. I originally had both arrays installed on Wire1 of a Teensy 3.5, but discovered that only 4 of the 6 elements were reporting 'real' values. After screwing around for a while, I came to the conclusion that the integral 10K pullup resistors on each sensor (times 6) was too much for the I2C bus. So, I decided to move one of the two 3-element arrays to Wire2, so I would be driving three sets of 10K pullups on Wire1 and three sets of 10K pullups on Wire2.

Unfortunately, even with the arrays split over the two secondary I2C busses, I can't get all six sensors to operate properly. One array of three elements will report believable values, but one or more of the other array will not. For all the gory details, see my 'Paynters Palace' post on this subject.

I ran the program with all 6 sensors (3 on each Teensy auxiliary I2C bus), and as expected, the first two sensors report bogus results. Then I ran it again using the 'debug' option on the 'rangingTest()' function to see if I could understand a little more about what is happening. Here is a representative readout from the program:

Opening port
Port open
Teensy Triple VL53L0X V2
In Adafruit_VL53L0X::begin(2A,0,7D0)
In Adafruit_VL53L0X::begin(2B,1,7D0)
VL53L0X Info:
Device Name: VL53L0X ES1 or later, Type: VL53L0X, ID: VL53L0CBV0DH/1$1
Rev Major: 1, Minor: 1
VL53L0X: StaticInit
VL53L0X: PerformRefSpadManagement
refSpadCount = 7, isApertureSpads = 0
VL53L0X: PerformRefCalibration
VL53L0X: SetDeviceMode
In Adafruit_VL53L0X::begin(2C,1,7D0)
VL53L0X Info:
Device Name: VL53L0X ES1 or later, Type: VL53L0X, ID: VL53L0CBV0DH/1$1
Rev Major: 1, Minor: 1
VL53L0X: StaticInit
VL53L0X: PerformRefSpadManagement
refSpadCount = 5, isApertureSpads = 0
VL53L0X: PerformRefCalibration
VL53L0X: SetDeviceMode
In Adafruit_VL53L0X::begin(2D,1,6F8)
VL53L0X Info:
Device Name: VL53L0X ES1 or later, Type: VL53L0X, ID: VL53L0CBV0DH/1$1
Rev Major: 1, Minor: 1
VL53L0X: StaticInit
VL53L0X: PerformRefSpadManagement
refSpadCount = 4, isApertureSpads = 0
VL53L0X: PerformRefCalibration
VL53L0X: SetDeviceMode
In Adafruit_VL53L0X::begin(2E,0,6F8)
In Adafruit_VL53L0X::begin(2F,0,6F8)
 
Init complete
 
VL53L0X API Simple Ranging example
 
Msec	Front	Center	Rear	Steer
sVL53L0X: PerformSingleRangingMeasurement
Range Status: 146 : No Update
RANGE IGNORE THRESHOLD: 11.41
Measured distance: 8850
sVL53L0X: PerformSingleRangingMeasurement
Range Status: 0 : Range Valid
RANGE IGNORE THRESHOLD: 1.47
Measured distance: 65398
sVL53L0X: PerformSingleRangingMeasurement
Range Status: 2 : Signal Fail
RANGE IGNORE THRESHOLD: 5.84
Measured distance: 173
sVL53L0X: PerformSingleRangingMeasurement
Range Status: 2 : Signal Fail
RANGE IGNORE THRESHOLD: 0.52
Measured distance: 661
sVL53L0X: PerformSingleRangingMeasurement
Range Status: 2 : Signal Fail
RANGE IGNORE THRESHOLD: 0.63
Measured distance: 464
sVL53L0X: PerformSingleRangingMeasurement
Range Status: 2 : Signal Fail
RANGE IGNORE THRESHOLD: 0.46
Measured distance: 490
9495	1000	1000	173	661	464	490

As can be seen, the first two sensors always return very large values (that get trimmed to 1000 by my code) so the first two values in each normal output line are always '1000' and '1000'. I have included my code for reference, but it is very simple. It just initializes all six sensors to consecutive I2C addresses and then calls 'rangingTest' on each one sequentially. After all six measurements, a line is printed out containing the number of milliseconds since program start, followed by each measurement value in the order taken.

I suspect there may be an issue with some interaction of the Wire1 & Wire2 auxiliary I2C busses on the Teensy 3.5 controller (and I have a separate post on their forum to explore this matter), but I was hoping there was something else I might be able to do to better understand exactly why the first two sensors are reporting bogus values. Any help would be appreciated.

I have attached a file containing the Teensy 3.5 sketch used to obtain the above printout (I had to change the file type from .ino to .txt)

Frank

5 REPLIES 5
FPayn.1
Associate III

I forgot to mention that all six sensors check out fine when used singly or in single 3-element arrays. It is only when I try to add more than 3 sensors that I run into problems.

FPayn.1
Associate III

In a different post regarding the VL53L1X sensor, there was a recommendation to "Read the Ranging status" and "Read the ambient light level" to further troubleshoot a problem. I to looked through your VL53L0X API document but didn't find anything for reading the ambient light level (I did find api information for the ranging status). Can you point me to the proper VL53L0X API function for ambient light level, and/or any other API calls that might be useful?

TIA,

Frank

FPayn.1
Associate III

In an effort to troubleshoot the problem, I used the 'debug' version of the call to PerformSingleRangeMeasurement. I am getting

sVL53L0X: PerformSingleRangingMeasurement
Range Status: 46 : No Update
RANGE IGNORE THRESHOLD: 32.00
Measured distance: 11194

for the measurement calls to the sensors that are not responding. What does 'No Update' mean?

TIA,

Frank

S.Ma
Principal

You have spare pins on the MCU and each TOF has fixed slave address.

Why not have 12 GPIOs to generate 6 I2C master by SW ? They would be totally decoupled. If you choose these on the same port, you could manage to run the 6 I2C concurrently.... and move forward.

I don't know if the XShutdown can be properly used as slave select of some sort...

Also make sure the supply voltage matches on both sides sensor and MCU or you may need voltage shifters with open drain capability.

Hmm, interesting idea, but I thought that was exactly what I was doing by using the Teensy's Wire1 & Wire2 hardware I2C buses, and since I had already verified that 3 VL53L0X sensors will run fine on a single I2C bus, you would think that 6 VL53L0X sensors would run fine on two independent I2C buses - it just doesn't seem to work.
I need some additional debug information from the VL53L0X to figure out what is happening, but the API doesn't seem to have the same amount of troubleshooting functionality as the VL53L1X.
I don't suppose you know what the 'No Update' status return from PerformSingleRangingMeasurement() is?
Frank