2022-04-12 06:35 AM
The title says it all. I can't find the info on any of the three documents i read (Datasheet/Api/ULD Api).
Thank you
Mirco
Solved! Go to Solution.
2022-04-21 12:24 AM
Hi, turns out it was a problem about types.
My uint32_t value was always truncated in a uint16_t value, hence the low intermeasurement time with high values.
Changing the uint32_t typedef in vlxxxx_types.h should solve my problem.
Thank you for your time! I wouldn't have checked if you didn't assure me that the sensor could sleep a lot😅
2022-04-19 04:43 AM
Anyone?
2022-04-19 09:36 AM
In the ultra-light driver, the code is below. It shows, as input, a unsigned 16 bit value in ms. So 65536/1000 is 65 seconds.
But if you are willing to play a little bit you see the sensor's register is an 32 bit value in milliseconds * the ClockPLL. Assume the clockPLL is 0x3ff (its max)
Also there is a 1.075 offset to handle the case were the fast clock and the slow clock are skewed.
So if you want to modify the code, you can enter (4 billiion/0x3ff)ms. , to bet a staggeringly large number. But you'd have to verify the accuracy of the timing however.
I've not tried it.
The current code handles 64 seconds, and we figured that was enough.
VL53L1X_ERROR VL53L1X_SetInterMeasurementInMs(VL53L1_Dev_t dev, uint16_t InterMeasMs)
{
uint16_t ClockPLL;
VL53L1X_ERROR status = 0;
status = VL53L1_RdWord(&dev, VL53L1_RESULT__OSC_CALIBRATE_VAL, &ClockPLL);
ClockPLL = ClockPLL&0x3FF;
VL53L1_WrDWord(&dev, VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD,
(uint32_t)(ClockPLL * InterMeasMs * 1.075));
return status;
The quick change to the code would be to put a *1000 in line 9. That would change the input from ms to seconds. Then you could do your own testing.
Don't forget to change the 'get' function as well.
2022-04-19 11:14 PM
Thank you!
I'll try.
2022-04-20 01:42 AM
I didn't change the code yet. I assigned 10000 to intermeasms but from what I see from the power consumption and the laser flashing, it does not wait ten seconds to do another measure.
I stop the ranging, change intermeas period, then resume ranging. I see it working when I stay in the range of 100-1000 ms but after that nothing.
Am i doing something wrong?
VL53L1X_StopRanging(DEVADDR);
VL53L1X_SetInterMeasurementInMs(DEVADDR, g_interMeasMs);
VL53L1X_StartRanging(DEVADDR);
g_interMeasMs is an unsigned short.
2022-04-20 06:40 AM
Well, that is hard to tell. I would have set the timing budget and the intermeasurement period and then issued the start.
What I think is getting you is that this sensor runs asynchronously. It generally does not stop the nanosecond you issue the stop, but after the current range ends. So I'm guessing your commands might not have been processed. But it's hard to tell.
From a rebooted sensor do he setup and issue the start. You should see something close to 10seconds.
At the very least put some waits between your commands.
Or you can issue the intermeasurement command without stopping, but it will not take effect until after the next range finishes.
2022-04-21 12:24 AM
Hi, turns out it was a problem about types.
My uint32_t value was always truncated in a uint16_t value, hence the low intermeasurement time with high values.
Changing the uint32_t typedef in vlxxxx_types.h should solve my problem.
Thank you for your time! I wouldn't have checked if you didn't assure me that the sensor could sleep a lot😅