Skip to main content
Associate
February 28, 2024
Solved

How to set the ranging frequency to 100Hz for VL53L4CD?

  • February 28, 2024
  • 1 reply
  • 2927 views

For the VL53L4CD,Is there a default ranging frequency that can be set to the highest ranging frequency of 100Hz?How to set ?

This topic has been closed for replies.
Best answer by John E KVAM

That 10 means you are ranging for 10ms - which should give you 100HZ or 1000ms/10 =100. If you are only getting 8Hz (8 measures per second) something is seriously wrong. Can you put a scope probe on the interrupt line? 

Every time the interrupt fires, you have to read the data and tell the sensor to clear the interrupt line. The scope probe should tell you what is going on? Does the line stay high?

You definitely can poll the sensor. That works, but don't poll it as fast as your MCU can - give it at least a quarter of a millisecond between polls. I say go, set a 10.1 ms timer in my MCU. When the timer goes off I start polling, generally gets it on the first try. 

And when you do get the data, make sure the interrupt is cleared.

have a look through the example code. Something is odd here.

- john

1 reply

John E KVAM
ST Employee
March 1, 2024

There is a function  - 

VL53L4CD_Error VL53L4CD_SetRangeTiming(
		Dev_t dev,
		uint32_t timing_budget_ms,
		uint32_t inter_measurement_ms)

You specify how for long the sensor should integrate (timing budget) and how long between ranges. 

If you go with 10 on both of these, you will do 100 ranges per second, and integrate for the full 10ms.

This same concept is valid for all the VL53 sensors, but the code varies as we evaluate what is easiest for our customers. The VL53L1X has two separate functions to do this same setting for instance

I'd read through the VL53L4CD_API.c . That code is as obvious as we could make it. 

But if you are in a hurry, read the VL53L4CD_API.h. There are very few functions and I hope the naming is obvious.

Good luck,

- john

m161189Author
Associate
March 4, 2024

I'll give it a try, thank you!