2020-08-20 11:21 PM
Then we tried to do calibration steps as per datasheet, but the offset we are getting is -25000(we placed the white object at 100mm) and cross talk is 0.
SOC : nrf52840
RTOS : Zephyr
GITHUB link for driver : https://github.com/zephyrproject-rtos/hal_st
My doubt is on driver where it is doing calibration for offset and cross talk
Line number 141 in this file, https://github.com/zephyrproject-rtos/hal_st/blob/master/sensor/vl53l0x/api/core/src/vl53l0x_api_calibration.c ,xTalkCalDistanceAsInt will become 0 because
it is shifted by 16 places.If this is the problem then so many places it is happening.
Can anyone help me solve this problem.Thanks in advance.
2020-08-26 07:01 AM
The hardware works in 10.2 format. that is if an offset is 25mm the hardware would give 25<<2. So two binary bits to the right of the implied binary point. (Almost like a decimal point, but in base 2).
However in the ST code someone thought that was odd, and though it would be easier for people to think in thousandths. So the multiplied the 25<<2 by 250 to give thousandths of millimeters - or micrometers.
The code is self-consistent. That means if you do the calibration and get a number, and then put that number back through the same set of software, it will work - even though the number looks odd.
To get a number that makes sense simply divide that number by 1000 and you get the offset in millimeters.
a -25mm is a very typical offset, even though it got left shifted by 2 and then multiplied by 250.
2020-08-27 04:42 AM
what about this line for cross talk https://github.com/zephyrproject-rtos/hal_st/blob/5b3ec3e182d4310e8943cc34c6c70ae57d9711da/sensor/vl53l0x/api/core/src/vl53l0x_api_calibration.c#L141 where xTalkCalDistanceAsInt becomes 0(because of shifting) and following condition(xTalkStoredMeanRange >= XTalkCalDistance) becomes true always, so i am getting 0 always.Is this also correct?