cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1X reading returns 0 with error code 31

will3
Associate II

I am getting occasional readings from this sensor of zero(0) reading result with the error code 31.  According to the header file this error corresponds to:

#define VL53L1X_WARNING_OFFSET_CAL_MISSING_SAMPLES ((VL53L1X_Error) - 31)
/*!< Thrown if there is less than the requested number of
* valid samples. */

This is not during Calibration offset process,  which we do use,  but at run time after SetOffset using the stored offset value.  

Very confused why I would get this error,  occasionally,  at run time?

Thanks,

Will

 

 

 

4 REPLIES 4
John E KVAM
ST Employee

That is strange indeed. Something is happening somewhere as that bit combination is not in the hardware of the device. I found nothing in all the documentation I have that shows you can get a 31. 

So if the hardware is not throwing a 31, then you have to dig through the code to see what is going on. 

Sorry to leave you with homework, but I have no clues as to what could be going on. 

Perhaps you could add a check right after the range status is being read to see if you could trap something. 

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

The #define I show is taken from the vl53l1x.h file.  How is that not in the hardware at all? The header file is from ST. 

The API I use to return the status is the same I use to return the reading:

VL53L1X_ERROR VL53L1X_GetResult(VL53L1X_Result_t *pResult)

Would this change your answer?

will3
Associate II

Hi John,

One change to my original posting,  I miswrote what the sensor reading.  It is in fact 32256 not Zero. 

Does this tell you anything more? 

Thanks,

Will