cancel
Showing results for 
Search instead for 
Did you mean: 

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

m161189
Associate II

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

5 REPLIES 5
John E KVAM
ST Employee

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


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.

I'll give it a try, thank you!

The current setting is already like this, but it still doesn't work. Can using polling to read reach a frequency of 100Hz?aa.png

(This is what I am currently setting up;The frequency is 10ms,but the actual frequency is only around 8Hz.)

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


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.

Okay, let's give it a try again. Thank you very much for your suggestion!