2021-03-03 11:43 AM
I am porting the VL53L0X API stack over to my platform, currently using a X-Nucleo-53L0A1 board. I am trying to debug this issue.
My issue seems very similar to this older post:
I pass Static init OK, but fail in the PerformRefSpadManagement, register VL53L0X_REG_RESULT_INTERRUPT_STATUS returns 0x54. this eventually drives a Status = VL53L0X_ERROR_RANGE_ERROR in the return.
I have two x-nucleo-53l0A1 boards and they both exhibit this error. Is the recommendation to modify the calibration api to ignore the 0x54?
I tried stepping past it in debug and proceeding, but If I continue past the error and configure for single ranging (high speed measurements), the measurement completes with no error but the data is all maxed.
Looking at the call stack:
0 VL53L0X_GetInterruptMaskStatus(VL53L0X_DEV Dev = 0x20007e58, uint32_t * pInterruptMaskStatus = 0x20007c30) vl53l0x_api.c 2899 0x00002970 (All)
1 VL53L0X_GetMeasurementDataReady(VL53L0X_DEV Dev = 0x20007e58, uint8_t * pMeasurementDataReady = 0x20007c57 "") vl53l0x_api.c 2323 0x00001F8A (All)
2 VL53L0X_measurement_poll_for_completion(VL53L0X_DEV Dev = 0x20007e58) vl53l0x_api_core.c 67 0x00003AE2 (All)
3 VL53L0X_perform_single_ref_calibration(VL53L0X_DEV Dev = 0x20007e58, uint8_t vhv_init_byte = 64 '@') vl53l0x_api_calibration.c 1079 0x000035AE (All)
4 VL53L0X_perform_vhv_calibration(VL53L0X_DEV Dev = 0x20007e58, uint8_t * pVhvSettings = 0x20007d19 "", const uint8_t get_data_enable = 0 '\000', const uint8_t restore_config = 0 '\000') vl53l0x_api_calibration.c 1147 0x00003836 (All)
5 VL53L0X_perform_ref_calibration(VL53L0X_DEV Dev = 0x20007e58, uint8_t * pVhvSettings = 0x20007d19 "", uint8_t * pPhaseCal = 0x20007d18 "", uint8_t get_data_enable = 0 '\000') vl53l0x_api_calibration.c 1230 0x00003A3E (All)
6 VL53L0X_perform_ref_spad_management(VL53L0X_DEV Dev = 0x20007e58, uint32_t * refSpadCount = 0x20007db0, uint8_t * isApertureSpads = 0x20007daf " \006") vl53l0x_api_calibration.c 766 0x0000302C (All)
7 VL53L0X_PerformRefSpadManagement(VL53L0X_DEV Dev = 0x20007e58, uint32_t * refSpadCount = 0x20007db0, uint8_t * isApertureSpads = 0x20007daf " \006") vl53l0x_api.c 3022 0x000029CC (All)
2021-08-24 01:25 PM
I've seen this RefSpad fail before. And most people ignore it an continue on. (There is a RefSpad setting in the Non-volatile memory although it was deemed better to do your own.)
I'd wouldn't step past the error, I'd let the refSpad complete and simply ignore the error return.
Oddly it seems to work fine without it.
(My guess is the refSPAD is actually doing the right thing, but it returns an 'incorrect' error somehow.