cancel
Showing results for 
Search instead for 
Did you mean: 

issue with status code using ST VL53L4CD_Sat_HelloWorld.ino sketch.ino

JBM
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
JBM
Associate II

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

View solution in original post

2 REPLIES 2
John E KVAM
ST Employee

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. 

STSW-IMG034

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


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
JBM
Associate II

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