cancel
Showing results for 
Search instead for 
Did you mean: 

vl53l5

LKM
Associate

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.

1 REPLY 1
John E KVAM
ST Employee

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

#define     VL53L5CX_NB_TARGET_PER_ZONE     1U
 
#define VL53L5CX_DISABLE_AMBIENT_PER_SPAD
// #define VL53L5CX_DISABLE_NB_SPADS_ENABLED
// #define VL53L5CX_DISABLE_NB_TARGET_DETECTED
#define VL53L5CX_DISABLE_SIGNAL_PER_SPAD
#define VL53L5CX_DISABLE_RANGE_SIGMA_MM
// #define VL53L5CX_DISABLE_DISTANCE_MM
// #define VL53L5CX_DISABLE_REFLECTANCE_PERCENT
// #define VL53L5CX_DISABLE_TARGET_STATUS
#define VL53L5CX_DISABLE_MOTION_INDICATOR

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. 

 

 


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.