cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1x continuous ranging without clearing the interrupt.

PHaef.1
Associate II

Hi,

I am using multiple (40) VL53L1x sensors. Is it possible to let the sensors continuously range and updating measurement results in the register without clearing the interrupt with the full-API function VL53L1_ClearInterruptAndStartMeasurement?

In the API documentation (UM2356) it says:

"The sensor performs the ranging continuously and autonomously with a programmable inter-measurement period". Is it possible make this autonomous measurements be reflected in the data register? The goal is to obtain the last valid measurement result according to time-budget and inter-measurement period without clearing every interrupt of all 40 sensors. E.g. each sensor automatically start a new ranging after the inter-measurement period.

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

In Lite_Ranging mode the host and the sensor work in lock-step to get a faster answer, so you are right.

but Autonomous, means exactly that. It works alone.

I cannot guarantee that that the data will all be from the same data collect, but if you do one IO operation it is extremely unlikely you will have an issue.


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.

View solution in original post

4 REPLIES 4
John E KVAM
ST Employee

If you want to use the interrupts then of course you have to clear them, but if you simply want to read a result of the latest range whenever you want to you can.

When you issue the start command, the sensor will continue to range until you stop it.

The range data you read will be the last valid range.

There is a small possibility that if you read the distance, the RangeStatus, the ambient light and all the other things that you need that the sensor will be updating as you read.

So you might get the distance from the prior range and the RangeStatus from the current range.

But if your object is moving slowly, both will be valid.

To limit the likelihood of this, consider using the VL53L1_GetRangingMeasurementData function. It reads the output of the sensor in one I2C read, limiting your exposure to the issue.

But if you don't clear the 'done' register, using the Wait-for-done function clearly won't work.

  • 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.
PHaef.1
Associate II

Hi John,

Thanks for your reply. I finally got it to work. Maybe it is worth mentioning if continuous ranging is desired one should use VL53L1_PRESETMODE_AUTONOMOUS mode and not VL53L1_PRESETMODE_LITE_RANGING.

VL53L1_SetPresetMode(&Dev, VL53L1_PRESETMODE_AUTONOMOUS); // use this
VL53L1_SetPresetMode(&Dev,VL53L1_PRESETMODE_LITE_RANGING); // do not  use this

In case of VL53L1_PRESETMODE_LITE_RANGING the measurement output will stay always the same if the interrupt is not cleared, but if VL53L1_PRESETMODE_AUTONOMOUS is used the output data is updated continuously.

I already use the function VL53L1_GetRangingMeasurementData from the driver library. So is it correct that when reading with this function all data contained in it are consistent to each other, i.e. status and range are from the same measurement?

John E KVAM
ST Employee

In Lite_Ranging mode the host and the sensor work in lock-step to get a faster answer, so you are right.

but Autonomous, means exactly that. It works alone.

I cannot guarantee that that the data will all be from the same data collect, but if you do one IO operation it is extremely unlikely you will have an issue.


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.
PHaef.1
Associate II

Ok, thanks for the information.