2019-07-23 10:16 AM
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.
2019-07-24 11:04 AM
I've seen this once before. It appears there was no default written into the non-volatile memory at the factory. (Or perhaps an incorrect one.)
Solution is to do a VL53L0X_SetReferenceSpad() prior to doing the Perform. By Setting a different number, it should work.
It's not obvious what values should be written but if you have a working sensor extract those values and use them.
Otherwise use some small number 3,0 should do it, I think.
2019-07-26 02:30 PM
Another approach is to edit out the error checks and get the device to run. I've been told the first few ranges will be bad. After that the sensor self corrects and runs successfully. Or just not do the RefSpad calibration and burn a dozen or so results.
2019-08-01 08:42 AM
Hi John,
Thank you for your (1st) reply. Here is what I observe:
Only these values returned VL53L0X_ERROR_NONE from VL53L0X_SetReferenceSpads call (refSPADCount, isAperture):
I took 44 as max refSPADCount. So within the aperture and non-aperture values, only these values resulted without error.
If I do VL53L0X_StaticInit after VL53L0X_SetReferenceSpads, the VL53L0X_StaticInit call sets refSPADCount and isAperture values to: (0,0) always.
If I put VL53L0X_StaticInit before VL53L0X_SetReferenceSpads then refSPADCount and isAperture values is read as they are.
Whatever I do VL53L0X_PerformRefSpadManagement always returns -50 : Reference Spad Init Error.
However, if try to use DF-Robot arduino library, the sensor works with a 10 mm offset. When I look at the sensor with a cellphone cam, I can see the light emitted from the sensor. But no luck with the STSW-IMG005 library. I could not be able to see the light also with a cam. No methods are working as shown on examples.
Here is an example output of the firmware that I use:
We are designing a product based on the VL53L0X. We have invested a lot, and I would like to make the sensor work with the supplier supplied library not with a reverse-engineered one. Would you please help / assist me digging the reason?
Thank you in advance.
2019-08-01 08:44 AM
I will try that. When I get the results I will post them. Thank you for the answer.
2020-05-13 06:59 AM
Hi @Mert Gülsoy ,
I know this is a bit old but I'm facing the exact same problem you had. Were you able to solve it?
Thanks in advance
2020-05-22 04:56 AM
Hi @pfontana96
Unfortunately we could not be able to solve the problem. Also the response times of the sensor are too high for our application so we have designed our own sensor. However, I have altered Pololu's library and made the sensor work. If you want I can send you the code. Send me a private message.