cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L8CX Data Read timming question: The time it takes to read the data when INT goes down.

davelee123s
Associate

"I'm using the VL53L8CX sensor, the en.X-CUBE-TOF1 example, specifically from NUCLE -F401RE\Examples\53L8A1\53L8A1_SimpleRanging. The data reads correctly,

and I have verified the outputs. However, when the INT pin goes low and triggers an interrupt, it takes about 16ms to read the data.

I measured this time by toggling a GPIO pin before and after the read function. Even after adjusting various settings, the read time remains similar.

I am using an I2C speed of 400kHz.

Is this typical for the read operation? Additionally, I'd like to optimize the timing for use in an RTOS environment, where timing management is critical.

Below is the configuration:

 

#define TIMING_BUDGET (20U) /* 5 ms < TimingBudget < 100 ms */
#define RANGING_FREQUENCY (40U) /* Ranging frequency Hz (shall be consistent with TimingBudget value) */
#define POLLING_PERIOD (1)
static void MX_53L8A1_SimpleRanging_Process(void)
{
  uint32_t Id;

  VL53L8A1_RANGING_SENSOR_ReadID(VL53L8A1_DEV_CENTER, &Id);
  VL53L8A1_RANGING_SENSOR_GetCapabilities(VL53L8A1_DEV_CENTER, &Cap);

  Profile.RangingProfile = RS_PROFILE_4x4_CONTINUOUS;
  Profile.TimingBudget = TIMING_BUDGET;
  Profile.Frequency = RANGING_FREQUENCY; /* Ranging frequency Hz (shall be consistent with TimingBudget value) */
  Profile.EnableAmbient = 0; /* Enable: 1, Disable: 0 */
  Profile.EnableSignal = 0; /* Enable: 1, Disable: 0 */

  /* set the profile if different from default one */
  VL53L8A1_RANGING_SENSOR_ConfigProfile(VL53L8A1_DEV_CENTER, &Profile);

  status = VL53L8A1_RANGING_SENSOR_Start(VL53L8A1_DEV_CENTER, RS_MODE_BLOCKING_CONTINUOUS);
 
}
 
thank you. It might be a little awkward using a translator, but I hope the intentions were conveyed well. :)
 
1 REPLY 1
John E KVAM
ST Employee

The read time is entirely dependent on the bus speed and the amount of data you want to send. 

I'd switch to 1Mbit. It will help a lot and unless you have long wires, won't hurt. 

next is to check the params in Platform.h. Are there any you can leave out. 

By default you get all of these. I disabled 4 of them by uncommenting them (in bold). 

// #define VL53L8CX_DISABLE_AMBIENT_PER_SPAD
#define VL53L8CX_DISABLE_NB_SPADS_ENABLED
// #define VL53L8CX_DISABLE_NB_TARGET_DETECTED
#define VL53L8CX_DISABLE_SIGNAL_PER_SPAD
#define VL53L8CX_DISABLE_RANGE_SIGMA_MM
// #define VL53L8CX_DISABLE_DISTANCE_MM
// #define VL53L8CX_DISABLE_REFLECTANCE_PERCENT
// #define VL53L8CX_DISABLE_TARGET_STATUS
#define VL53L8CX_DISABLE_MOTION_INDICATOR
and most people do not need all these. 
You need Target Status and NB_Targets_detected. You need distance. Pick either Reflectance_Percent or the combo of signal_per_spad and NB Spads - but not both. 
I find Sigma of little use, and maybe skip motion. Ambient is small, so keep that. 
Commenting these out will shrink the size of the return data structure a lot.
Use the sizeof() function and check the size of that return structure. Then maybe make other selections. 
- john 
 

 

 


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.