cancel
Showing results for 
Search instead for 
Did you mean: 

Techniques for multiplexing VL53L4CX

MGG
Associate II

Hi @John E KVAM ... I have seen several discussions about best way to use multiple VL53L4CX sensors, and I've appreciated your responses.  ("Every reboot is its own adventure!").  

I'm currently implementing an unusual setup that has 5 of these sensors that could conceivably interfere with one another - we are trying to get our mounting and the view-cones to be as independent as possible, but it can't be guaranteed.   We are using the bare STM32duino library on an ESP32 (Arduino/C++) micro, which is also doing many other things.

Given the physical setup of our system, it is difficult to run single lines to all the chips for XSHUT.  We would very much like to work only with the simple STEMMA/QT-style 4-conductor I2C cabling.   For this reason, we've opted to use an I2C multiplexer, rather than changing the addresses of the chips.

So my questions are: 

1. Is there an I2C command to tell the chip to reset itself?   In our project's operation, changes in host firmware or other changes result in new instantiations of the sensor class, and if that occurs I'd like to reset the chip completely via I2C and begin the initialization again.  If possible, I'd like to not have to toggle the XSHUT or physically power off the chip, as we'd prefer to use only I2C cabling

2. in the event that I need to use XSHUT to reboot the chips, I am considering a hack whereby all of our sensors' XSHUT pins are linked to each other and to +5V with a weak pullup resistor and we then use one of our I2C mux ports to address them as follows:    switch to the 'special' I2C mux, disable I2C and assign one of the lines (CLK most likely) as a GPIO, and then toggle a low/high sequence to effectively reset the chips.  Re-enable I2C, and continue multiplexing the sensors with appropriate startup routines followed by ranging.    I guess I'm asking this question to see if there are gotchas you can identify, or a much simpler solution, before proceeding with a prototype of this.

3. when 'VL53L4CX_StopMeasurement()' is called, does the laser actually shut off?  I'm hoping we can use this intermittently to step through our various sensors without fear of crosstalk, but I'm not sure if it's working.  Is there a better way to ensure only reading one ranger at a time?  Or, is this a significant concern, or might we assume each device will work independently?

 

Your responses are very much appreciated!  - also any input from anyone else who has done this sort of thing is welcome too of course!   

Thanks so much.

<M>

1 ACCEPTED SOLUTION

Accepted Solutions
John_Kvam
Associate III

John E Kvam has retired. In his place you get me - John_Kvam. Same guy, but paid a whole lot less. Now I really am doing this just for fun. And I kind of owe ST. They have been very good to me.

The official line is either power the sensors off or use the XShut line to reset them. So if you could just drop power and then use your mux to talk to them, you should be all set. 

The 'VL53L4CX_StopMeasurement()' command does indeed stop the VCSEL (Laser) but there was new release to the VL53L1X software that changed the stop command from "Stop at then end of your next measurement" to "stop NOW!". You need that fix to insure the sensor stops on time. 

Note you can tell if the sensor is stopped by pointing a camera at it. But don't use an IPhone - that device has a very good IR filter that hides the 940nm flash.

But consider this... if you want to interleave them, just give each of them a 30ms Timing Budget and use 200ms Inter-measurement period. Then stager the start times by 35ms or so. This way they just run and you can read data whenever you like. You could cut it closer, but getting an exact start time with a MCU is a bit of a trick, and the timing might be a bit skewed. So leave whatever buffer you think best. 

Or you could start 1, 3 and 5 at time A, and 1 Timing budget later you could start 2 and 4. That way adjacent sensors would not compete and you use maybe a 80ms Intermeasurement period. 

Good luck. 

- john

 

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.

View solution in original post

2 REPLIES 2
John_Kvam
Associate III

John E Kvam has retired. In his place you get me - John_Kvam. Same guy, but paid a whole lot less. Now I really am doing this just for fun. And I kind of owe ST. They have been very good to me.

The official line is either power the sensors off or use the XShut line to reset them. So if you could just drop power and then use your mux to talk to them, you should be all set. 

The 'VL53L4CX_StopMeasurement()' command does indeed stop the VCSEL (Laser) but there was new release to the VL53L1X software that changed the stop command from "Stop at then end of your next measurement" to "stop NOW!". You need that fix to insure the sensor stops on time. 

Note you can tell if the sensor is stopped by pointing a camera at it. But don't use an IPhone - that device has a very good IR filter that hides the 940nm flash.

But consider this... if you want to interleave them, just give each of them a 30ms Timing Budget and use 200ms Inter-measurement period. Then stager the start times by 35ms or so. This way they just run and you can read data whenever you like. You could cut it closer, but getting an exact start time with a MCU is a bit of a trick, and the timing might be a bit skewed. So leave whatever buffer you think best. 

Or you could start 1, 3 and 5 at time A, and 1 Timing budget later you could start 2 and 4. That way adjacent sensors would not compete and you use maybe a 80ms Intermeasurement period. 

Good luck. 

- john

 

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.
MGG
Associate II

Thanks John, and congratulations on your retirement!

I'll look into using a GPIO for the +5V power line... that's a great idea, and would very much simplify the 'brute force' reset I'm looking to do.

I'll also play with timing to try to make sure I'm only ranging with one sensor at a time... that should do the trick if I can get the code to behave simply enough.  Thanks so much for these suggestions.  More soon.

<M>