Unable to get distance measurements from VL53L3CX
I'm using an ESP32 to communicate with the VL53L3CX. I successfully reworked the vl53l3cx_platform.c file to get communication working with the sensor using I2C, which is a good start. But when I go to read from the sensor (using polling, not hardware interrupt mode) I can't seem to get any valid measurements.
The status of the readings mostly alternates between 4 and 5, with an occasional 14. I see plenty of negative distance measurements. But unfortunately, not status readings of 0 indicating that the reading is valid (not that I'd expect negative distance readings to be valid). Screenshots of logs are at the bottom of the post.
I do not perform any calibration for now as I'm just trying to get some initial readings. Could this be the problem? I wasn't sure if the sensor must be calibrated before measurements can be successfully collected.
My code works as follows:
- Initialize I2C code
- VL53LX_WaitDeviceBooted
- VL53LX_DataInit
- VL53LX_StartMeasurement
- VL53LX_GetMeasurementDataReady
- Once ready, VL53LX_GetMultiRangingData
- VL53LX_ClearInterruptAndStartMeasurement
I loop through steps 5-7.
As you can see in the screenshots, the Stream Count (displayed as Count) does not increment as expected either. To explain more terms in the logs, Status refers to the RangeStatus, D is RangeMilliMeter, Signal is SignalRateRtnMegaCps, and Ambient is AmbientRateRtnMegaCps.
Let me know if I can clarify anything, and thanks in advance for any help!


