2022-08-06 05:53 AM
Hi
I'm getting range status 6 while I'm reading the sensor, which corresponds to (No Update) Status.
Test code (kept the necessary debugging prints):
int16_t getDistance(void)
{
int status = VL53L1_StartMeasurement(Dev);
uint8_t firstTimeInterrupt = 1;
static VL53L1_RangingMeasurementData_t RangingData;
do /* interrupt mode */
{
__WFI();
// SENSOR_DEBUGF("got an interrupt,IntCount=%d\n", IntCount));
if (IntCount != 0)
{ // Is this necessary ? >> yes.
IntCount = 0;
if (firstTimeInterrupt == 0)
{
status = VL53L1_GetRangingMeasurementData(Dev, &RangingData);
if (status == 0)
{
Serial.printf("Status:%d\tD=%d\tSignalC=%u\tAmbientC=%u\n", RangingData.RangeStatus, RangingData.RangeMilliMeter,
RangingData.SignalRateRtnMegaCps / 65536.0, RangingData.AmbientRateRtnMegaCps / 65336.0);
}
status = VL53L1_ClearInterruptAndStartMeasurement(Dev);
return RangingData.RangeMilliMeter;
}
else
{ /* Must not read data at the first interrupt, must clear interrupt and start measurement */
status = VL53L1_ClearInterruptAndStartMeasurement(Dev);
firstTimeInterrupt = 0;
}
}
} while (1);
}
What's interesting is the sensor reads and correctly prints the range:
> Status:6 D=60 SignalC=0 AmbientC=1076956160
The used library is: STSW-IMG007_v2.4.5.
2022-08-10 04:54 PM
Hello,
Technically you are using a VL53L1CB. You can find the UM of the API here.
A status 6 means VL53L1_RANGESTATUS_RANGE_VALID_NO_WRAP _CHECK_FAIL. It will always happen on the first range. In order to check for the WRAP one needs two ranges. This is just a warning telling you might have a wrap, we don't know. After the second range, you should get more normal responses.
2022-08-11 04:08 AM
Thank you again for your information,
@Anne BIGOT
This is somehow shocking to me, as we've bought modules claimed to be VL53L1X, in which we've proceeded upon.
As of this article, it's 8 meters long instead of 4, is there any tradeoffs?
As we could need longer than 2-3 meters to measure water levels, perhaps VL53L1CB is the answer, am I correct?
I think I'd need to convert my project to use STSW-IMG019 instead of STSW-IMG007, right?
One last question: Where can I find more information about the wrapping range states?
Thank you again.
Hamza