2024-07-09 12:20 AM
Hi, I use ToF sensor with multisensorRanging code from stm.
I wanted to check data faster (like twice per 1 second...), But when I set RANGING_FREQUENCY as 4U, I can't get all of the data. There is some loss of data when I set a bigger frequency.
I wonder what are TIMING_BUDGET, RANGING_FREQUENCY and POLLING_PERIOD.
Solved! Go to Solution.
2024-07-11 02:16 PM
With the multi-zone parts, the data returned by the sensor can be a lot. And with multiple sensors the I2C bandwidth becomes a factor. Set that to at least 400K and 1M is better.
Then have a look at the platform.h. Disable as many returns as you can. If you only want one target per zone, that will cut the data in half. So look there.
Consider
Backward as it seems, one uncomments the stuff you want to disable.
in your code you eventually call:
status = vl53l5cx_get_ranging_data(p_dev, &Results);
Check the size of the Results data structure. It will tell you how much data you have read.
Once a range ends, the next will start. That way you can read out, while the next measure is being taken.
However, if you start a read, the sensor will stall until you read the last byte of the output.
(If you don't start the read, the sensor will happily keep going.)
This way, you won't lose any data.
In continuous mode, once the range ends, the next will start. You only have to define the integration period.
In Autonomous mode, you define the integration period (Timing Budget) and an inter-measurement time. IMT is the time from the start of one measurement to the start of the next. So 200ms means 5 measures per second. The Timing budget (TB) is the time you tell the sensor it can spend on each measure. The delta between the @200ms and the 5, the sensor is just resting.
The trick is to poll often enough that you know when the sensor is done, and you can read the data. In our example we poll ever 5ms. But I'd go with 1ms if you are worried you don't have enough time.
2024-07-11 02:16 PM
With the multi-zone parts, the data returned by the sensor can be a lot. And with multiple sensors the I2C bandwidth becomes a factor. Set that to at least 400K and 1M is better.
Then have a look at the platform.h. Disable as many returns as you can. If you only want one target per zone, that will cut the data in half. So look there.
Consider
Backward as it seems, one uncomments the stuff you want to disable.
in your code you eventually call:
status = vl53l5cx_get_ranging_data(p_dev, &Results);
Check the size of the Results data structure. It will tell you how much data you have read.
Once a range ends, the next will start. That way you can read out, while the next measure is being taken.
However, if you start a read, the sensor will stall until you read the last byte of the output.
(If you don't start the read, the sensor will happily keep going.)
This way, you won't lose any data.
In continuous mode, once the range ends, the next will start. You only have to define the integration period.
In Autonomous mode, you define the integration period (Timing Budget) and an inter-measurement time. IMT is the time from the start of one measurement to the start of the next. So 200ms means 5 measures per second. The Timing budget (TB) is the time you tell the sensor it can spend on each measure. The delta between the @200ms and the 5, the sensor is just resting.
The trick is to poll often enough that you know when the sensor is done, and you can read the data. In our example we poll ever 5ms. But I'd go with 1ms if you are worried you don't have enough time.