2024-06-21 07:02 AM - last edited on 2024-06-21 07:13 AM by Peter BENSCH
Hi, I'm trying to use the VL53L0X sensor driver with zephyr and nRF52833, but I'm getting errors when the driver is trying to calibrate.
Below are the errors returned by the log system:
My question, how could I solve this, it seems to be a software problem right?
2024-06-25 08:34 AM
At the factory the RefCal is set, but it changed during your reflow. The problem is that it's so far off that the correction fails. The trick in this case is to set the RefCal =2, then run the calibration again.
That should fix it.
- john
2024-06-25 09:37 AM
Hello, where can I find RefCal inside the driver? After that do I need to perform manual calibration, or just setting RefCal = 2 is everything ok?
2024-06-26 08:33 AM
I'm sorry. I was not clear.
Do the RefSpad calibration. Most will pass just fine.
if you get a failure,
Set the RefSpad calibration to 2.
Re-run the RefSpad calibration. It will pass.
Then move on.
The reason this works is the factory cal is so far off the calibration cannot adjust in a few rare cases.
Setting the RefSpad starting point to 2 allows the algo to adjust better.
- john
2024-06-26 09:57 AM
Hello, could you just tell me in which file this variable is in which I need to assign the value 2? because I'm still not finding this variable in the driver files. Awaiting return.
2024-06-26 10:45 AM
When you reboot, you are going to need to write the calibration data to the sensor. When you get a failure, I'm asking you to use that same calibration write routine to put a 2 into the RefSpad. Then re-run the calibration. it will pass the second time. then you can read the result out, and use that result for all subsequent boots.
- john
2024-07-11 04:59 AM
Hi, As I am using the driver in the zephyr rtos system, the driver is closed, so it is more complicated to change the initialization flow. However, tracing the code, go to this function:
How can I assign the spad ref value 2, as suggested by you, in the context I'm showing you?
2024-07-11 01:01 PM - edited 2024-07-13 09:42 AM
The code should look like this:
2024-07-12 07:12 AM
hello, I can't find the function you suggested: VL53L0_set_reference_spads(&drv_data->vl53l0x,2, 0); Could you tell me how to add it, or is it already part of the driver?
2024-07-13 09:26 AM
I think the function name is VL53L0X_set_reference_spads(...), it's in VL53L0X API.