2020-12-03 12:53 AM
I'm referencing to STSW-IMG009 and specifically function VL53L1X_SetInterMeasurementInMs(uint32_t InterMeasMs)
What would be the maximum size of the argument and the value of ClockPLL. I'm re-writing for another platform.
Regards
/Claes
2022-03-28 05:07 PM
The register is 32bits.
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;
}
So if you assume ClockPLL is 0x3ff (because it can be) I'd use 1024 for that.
so 2^32 = 2^10 * InterMeasMs* 1.075.
InterMeasMs = (2^32 / 2^10) /1.075
So I get a max InterMeasMs of 3.9million, which is a LOT of seconds.
If you were going to wait that long, I'd seriously consider turning it all off and restarting it again.