VL53L0X_GetReferenceSpads() function retuns 0 as Spad count and PerformRefSpadManagement fails with Reference Spad Init Error. Why?
After static init in the code:
if(distOpStatus == VL53L0X_ERROR_NONE) {
Print("Getting ReferenceSpads: ");
distOpStatus = VL53L0X_GetReferenceSpads(pDistanceSensor, &refSpadCount, &isApertureSpads);
}
if(distOpStatus == VL53L0X_ERROR_NONE) {
Print("Success! ");
snprintf(TxBuffer, 64, "SPAD cnt: %lu, isApartureSpads: %u\n", refSpadCount, isApertureSpads);
Print(TxBuffer);
}the refSpadCount returns 0. Then:
if(distOpStatus == VL53L0X_ERROR_NONE) {
Print("Setting up interrupt pin mode: ");
distOpStatus = VL53L0X_SetGpioConfig(
pDistanceSensor,
0,
VL53L0X_DEVICEMODE_SINGLE_RANGING,
VL53L0X_GPIOFUNCTIONALITY_OFF, //off
VL53L0X_INTERRUPTPOLARITY_HIGH
);
}
if(distOpStatus == VL53L0X_ERROR_NONE) {
Print("success!\nPerforming RefSpadManagement: ");
//SPAD : Single Photon Avalanche Diodes
distOpStatus = VL53L0X_PerformRefSpadManagement(pDistanceSensor, &refSpadCount, &isApertureSpads);
}VL53L0X_PerformRefSpadManagement is failing with: Reference Spad Init Error (-50) .
By ignoring this error and trying to make single shot measurement fails always. What is wrong with my setup?
I am using Nucleo-G071RB with STM32CubeIDE (v1.1) with sensor breakout board from adafruit. I adapted the STSW-IMG005 using platform functions. I2c comm is working fine.
