cancel
Showing results for 
Search instead for 
Did you mean: 

Maybe an elegant way to address multiple VL53L1X sensors.

GAlbe
Associate II

Can I use the GPIO1 from the first sensor on the I2C bus to control the XSHUT pin on the second sensor etc.

Here is the plan.

Assume that I do not use the GPIO1 pins to interrupt my microcontroller. I will use the API to check it there is new data.

XSHUT on sensor1 is hardwired High. Sensor1 is in SW_Standby.

On sensor1 GPIO1 is High until a measurement is ready. It is connected thru an inverting transistor to the XSHUT on sensor2 so sensor2 is in HW_standby. All the following sensors should also be in HW_standby also.

Anything wrong yet?

I use the driver to send a command to change the I2C address. Since only the first sensor is in SW_standby only it will accept the new I2C address.

Now for the magic that I need from you folks!

Since GPIO stand for General Purpose Input/Output I'm hoping that there is some way to use it as General Purpose I/O and Set the GPIO on sensor1 low thus switching XSHUT on sensor2 high and putting it in SW_standby mode.

Than I send the change I2C address command to the bespoke I2C address and we are off the the races.

If there is not some command in the driver leftover from what I imagine were the early days when GPIO was still GP that will allow me to control it, is there a tricky way that I can fool it with inturrupt resets or something into doing what I want?

Thanks

G

6 REPLIES 6
John E KVAM
ST Employee

I could kill the guy who left the names as GPIO1 and GPIO2 in our documentation. Perhaps they were GPIO's to start with, but by the time the chip was complete, they were the SHUTDOWN pin (IN) and the INTERRUPT pin (OUT). We have no alternative control over them.

I've heard of this idea before, and I advise against it. The problem is that the SHUTDOWN pin is pretty much on a hair trigger. Even a small glitch is going to cause the chip to go into standby, and then come out - essentially a reboot. Then of course you lose your access to the chip as the I2C address with have reverted to default.

Every now and again someone does not use a strong enough Pull-up on the SHUTDOWN line and the chip resets due to a glitch. It causes them a lot of grief as the system could work for days until it just stops. I fear that your design would suffer from this same issue.

So while in theory it's a fine idea, I'm thinking it would just get you in trouble.

Sorry about that.


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.
GAlbe
Associate II

Opps selected answer. Wanted reply

Thanks for the quick reply. Can you clarify a bit? When you say "I've heard of this idea before, and I advise against it." You must not mean the idea of changing the I2C address. Surely that must happen all the time. You must not mean connecting some control circuitry to the XSHUT pin either since that is exactly what is suggested in the application note on using multiple sensors. Frankly, the note also suggests changing the I2C addresses.

What is the this in "..this idea..?"

Thanks in advance for any advice.

Regards,

G

John E KVAM
ST Employee

It's the idea of using the pins for anything other than Interrupt and Shutdown that I advise against.

Bringing each chip out of reset and changing the address is expected - it's what you have to do.

But using the Interrupt and Shutdown pins for anything other than interrupt and Shutdown is discouraged.

(I won't even call those pins GPIOs - they are not General Purpose any more. We assigned the function.)

So connect each Shutdown pin to your MCU under program control, and you will be much happier.)


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.

Thanks. We have five sensors. The first one has a pull-up in the XSHUT on the rest have pull-downs and are also connected ti a pin from the MCU. We change all of the addresses.

It might be a good idea to ping the original address. If we get a response we would know that there is a problem and something has been reset.

S.Ma
Principal

5 devices? Just implement I2C by SW and GPIOs.

If you really want to make things more complicated to save pins, just implement the same SDA for all slaves and individual SCL for each one of them.

As long as the SCL is low, SDA is ignored. The line loading (capacitance) will be on SDA.

Thoughts?