cancel
Showing results for 
Search instead for 
Did you mean: 

vl53l7cx_get_ranging_data returning some pixels with distance 0

marte1234
Associate
Hello,
We have lately been seeing in some cases that one or two pixels seem to be stuck at distance_mm==0.
Sometimes the pixel goes back to returning normal values after some time or after a power cycle, but sometimes it seems to report a zero value consistantly.
 
I will implement some more debugging to get the status of the measurements, but I was wondering if you had any input into why a zero value could be measured for one or two pixels?
3 REPLIES 3
Zhiyuan.Han
ST Employee

Hi 

This sound strange, may I know your test setup

  • With or without a cover glass on top of VL53L7CX?
  • How long distance from VL53L7CX to real target?
  • which driver version are you using? and possible to share some datalog?

 

Br

Zhiyuan.Han


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.
AlexCloned
Senior

Hello,

Are you sure to be checking Number of targets before browsing Result[] array for each zone?
Results beyond Number of tarjets for each zone shoudl not be considerede. Neither should be considered a distance of a valid tarjet whose status code is not 0x05 (valid measurement).

Example of a scan for valid distances reported in Result:

for( my_Target = 0; my_Target < Result.ZoneResult[number_of_zone].NumberOfTargets; my_Target ++ )

{
    if( Result.ZoneResult[number_of_zone].Status[my_Target] == 0 )
    {
     //code using valid distance
      useful_distance= Result.ZoneResult[number_of_zone].Distance[my_Target];
  ...
    }//if
}//for

 

 

John_Kvam
Senior

AlexCloned is right

With the VL54L5, L7 or L8, one really should check the number of targets and the status before even looking at the distance data. These sensors do NOT clear out stale data but simply overwrite what is in the buffer. So, if you go from 1 target with a valid status, to ZERO targets, the old distance and the old status is still in there. 

(As a computer scientist, this drives me crazy, but it's a big buffer and takes time to clear, so the chip designers opted not to do it.)

You get No target when the signal is too low, meaning the distance is too great or the target has a very low reflectivity. It can also happen if the ambient light is too great - generally caused by sunlight. 

Look at the user manual and look for the Range Status - there are a dozen ways to fail. 

But if you are going from valid to invalid, you are on the edge of something. 

It's easy for me to say -just print out the number of targets, and the Range Status and the distances, but I realize not all systems are connected to serial ports. 

Change your code to what AlexCloned or use this logic

If (targets >= 1 AND RangeStatus is valid - 5,6,9 and possibly 12) Return distance. 

you might consider 

If (targets >= 1 AND RangeStatus is INvalid) Return a negative Range Status. 

That way you can gather statistics on likely failure modes.

- john

That might clear up some things. 

 

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.