Skip to main content
mf101
Associate III
April 14, 2021
Question

VL53L1X singleshot measurement

  • April 14, 2021
  • 4 replies
  • 1288 views

Currently we are using the VL53L1X ULD API which only supports autonomous mode. We would prefer to have a manually controlled measurement flow like the following:

  1. Start singleshot measurement
  2. Wait for interrupt
  3. Read measurement data and clear interrupt
  4. Start from the beginning

After indicating a finished measurement the VL53L1X sensor must not perform any further measurement and wait for the host MCU to service the interrupt.

Is there any possibility to realize this ? The full API provides code for singleshot operation, unfortunately it seems like it is not fully implemented.

This topic has been closed for replies.

4 replies

John E KVAM
ST Employee
April 14, 2021

The one thing to note is that your MCU is a lot faster than the ToF device.

You would probably not have a problem if you issued the start, got the interrupt, and simply issued a stop instead of the clear interrupt.

But there is a way to guaretee this behavior.

Set the Intermeasurement period to something large.

(The IM is the time between two successive ranges.)

Set the IM to a half second - a crazy long time.

You will get your range data and have nearly forever to issue the stop command.

Then when ready, you can issue another start.

The 'single shot' mode was meant to work like this.

Issue the start, poll for done, issue the stop, read the data.

By default the chip will range continously, so you have to stop it to get the behavior you desire.

mf101
mf101Author
Associate III
April 15, 2021

Thanks for your response. Is there any way to configure the sensor for true singleshot operation ?

According to the file "vl53l1_register_map.h" in the register VL53L1_SYSTEM__MODE_START there is a bit "mode_range__single_shot" and in "vl53l1_ll_device.h" a measurement mode VL53L1_DEVICEMEASUREMENTMODE_SINGLESHOT.

For some reason the API only provides the preset modes VL53L1_PRESETMODE_AUTONOMOUS, VL53L1_PRESETMODE_LITE_RANGING and VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS.

All of these preset modes use either VL53L1_DEVICEMEASUREMENTMODE_TIMED or VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK.

Can you explain why ? In this context, I would also like to know what "back to back" means and how it compares to timed and singleshot.

Regarding the measurement stop: What is the difference between VL53L1_DEVICEMEASUREMENTMODE_ABORT and VL53L1_DEVICEMEASUREMENTMODE_STOP ?

John E KVAM
ST Employee
April 15, 2021

I'm resonably certain that a 'stop' will stop after the current range is complete, the abort aborts as soon as it gets the command.

But I can tell you how to test it.

Find an older cell phone that is NOT an Iphone. You can use the camera to take a picture and watch it range. The reason that you need a older non-iphone is most new cameras and all Iphones emit their own 940nm light. And thus have really good IR filters on their cameras. Find someone with a Samsung that is a year or two old. A laptop camera also works, but are much harder to position correctly.

Under the covers, the device does 2 ranges. This is to detect something called radar aliasing. (Google it - it's interesting).

In Lite mode, you get an answer after each half-range. That's why this mode is faster. But it counts on continous ranging. Acutally making the subsequent ranges more accurate.

The other modes also use the information from one range to 'tweak' the ranging parameters makeing the next ranges better.

I think that may be why the mode settings discourage single mode ranging. It's not as accurate as multi-ranging.

But if power is your main problem, then a single range is the way to go.

SYSTEM__MODE_START

Bit order is 7 6 5 4 3 2 1 0

All bits read/write

Address:    reg_bank_go2_hostBaseAddress + 0x087

Type:    R/W

Reset:    0x0

Description:   

[7] mode_range__abort: Abort current range

[6] mode_range__timed: Timed Ranging (set high to start, set low to stop)

[5] mode_range__back_to_back: Back to Back (set high to start, set low to stop)

[4] mode_range__single_shot: Single Shot (auto clear)

[3:2] readout_mode: Readout Mode

0: Single SD

1: Dual SD

2: Split readout

3: Manual

[1:0] scheduler_mode: Scheduler Mode

0: Pseudo Solo Scheduler

1: Streaming Scheduler

2: Histogram Scheduler

You are in a bit of uncharted territory here, and I don't recommend this.

But you can clearly read a manual, and don't mind digging deep.

  • john

mf101
mf101Author
Associate III
April 15, 2021

Thanks for your explanation. We were finally able to perform singlehots measurements. Since it didn't explain a measurement issue experienced with the sensor, I opened a new topic.