cancel
Showing results for 
Search instead for 
Did you mean: 

Why vl53l0x returns 8191 all the time

afra
Associate

vl53l0x interfacing STM32F7

I used Pololu libraries and replaced read and write functions with HAL functions, at first it worked properly for several hours, but after that it stopped working and returned 8191 value, after two hours it started working again while I changed nothing. Now again it doesn’t work and still returns 8191 and I don’t understand why it’s happening

5 REPLIES 5
John E KVAM
ST Employee

When the sensor cannot return a successful scan, it returns 8192-error number. You can check this by reading the status value.

So in this case the 8191 is not a distance - it's an error indication.

An error 1 is Sigma Fail - that means the standard deviation of all the photon arrival times is wider than what you have specified.

So some environmental condition changed such that you did not get a reliable distance.

My guess is sunlight. Could it be that the sensor worked pointing to something far away. Then the sun started coming in through a window, causing the Sigma fail. And when the sun went down (or the angle changed) the sensor started working again?

One way around this is to increase the sigma value (there is a function call).

But at some point there will be an amount of ambient light that the ToF sensor will not work.

Keep experimenting.

If the sensor cannot be made to work, I might suggest the VL53L1X. It's a bit more expensive, but it might work if your ambient is not too high.

  • john


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.
AKing.1
Associate

Hello,

I am having similar problems, could ST provide more information on the Error codes? I cant seem to find any mention within the provide source information.

Best Regards

Alister King

John E KVAM
ST Employee

​For each sensor there is a datasheet and a user manual. The errors are in the user manual.

For the VL53L0X it's UM2039 User Manual

Search for it on ST.com. There will be a download.

0 Range Valid - Ranging measurement is valid

1 Sigma Fail - Sigma fail will trigger particularly in ambient light, when the amount of ambient

light is adding too much noise onto the ranging measurement.

2 Signal Fail - Signal fail will trigger when the return signal is too low to give enough

confidence on the range measured. The limit will be given by either the signal

limit or the RIT (Range Ignore Threshold).

3 Min Range Fail - Not enabled as default.

4 Phase Fail - Phase fail will trigger when wraparound conditions are detected or when noise

on signal is too high.

5 Hardware Fail - Hardware Fail will trigger if a VCSEL failure, or VHV fail are detected.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.
AKing.1
Associate

Hi John,

Thank you for this!

Could i ask you to provide more clarification more on "0 Range Valid", is that returning a 0mm range?

What is meant by a valid reading surely it would just return a range value ?

John E KVAM
ST Employee

When the range is complete you can ask for the Range which is the distance measurement, the RangeStatus which is a indication of the quality of the result. You can also get a measure of the ambient light, and the signal strength. There are others, but these are the main ones.

Taken together, you get a good idea of what you are 'looking' at.

A RangeStatus=0 is a Valid measurement, Sigma and Signal errors are an indication that something 'flakey' is happening with your target. Consider them a warning that the Range data is suspect.

A phase Fail is an indication you might have "radar aliasing" (Google that one), or your target could have moved during ranging.

If you get a 5, you will always get a 5 until you reset the chip.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.