2024-07-08 12:45 PM
I am a beginner in this field. Can anyone help me?
I am testing Adafruit VL53L4CD and Arduino Nano with Atmel ATmega328P 16 MHz processor.
Only 10 cm. wire is connecting the Adafruit board and the Nano board.
I have an issue with status code using ST VL53L4CD_Sat_HelloWorld.ino sketch.ino
When distance is below approx. 500 mm. Status = 0 (OK).
When distance is below approx. 1.400 mm. Status = 2 (Wire: Received NACK on transmit of address?)
When distance is above approx. 1.400 mm. Status = 4 (Wire: Other error?)
Some times also status = 7?
The status may originate from Wire.endTransmission()
I have analyzed the I2C protocol using PicoScope. I can't figure out what's wrong. Se oploaded image.
I would expect nice square shapes for SDA and SDC. But that is not the case?
Regards Joergen
Solved! Go to Solution.
2024-07-12 02:06 AM
Thank you john for the clarification.
To help others get started quickly, I've uploaded an Arduino sketch with all the range return statuses.
Regards Joergen
2024-07-08 01:37 PM
you are confusing ReturnStatus with Status.
Status is the return of the function - basically pass/fail.
ReturnStatus is what the sensor tells you.
The folks at AdaFruit changed the interface a bit from what ST wrote, but I'll bet they did not change it that much.
ReturnStatus is defined in the ST API User manual which is cleverly hidden in ST's software download.
Ultralow power (ULP) application programming interface (API) for the VL53L4CD Time-of-Flight sensor |
0 - means you have a fine range. It's perfect
2 - means you have low signal. Meaning the object you are looking at has not returned enough photons to get a good distance.
4 - means you are past the 1.3 maximum reliable distance.
And there are a few others, but you have the most common of them.
But if you did get an I2C failure, the bus would be stuck low, and the Status (not ReturnStatus) would be non-zero.
- john
- john
2024-07-12 02:06 AM