2025-07-08 12:20 AM - last edited on 2025-07-09 2:36 AM by Andrew Neil
Does ST supports multiple slave devices for single spi, I want to use mutiple VL53l8cx sensors on single spi bus using multiple chip select. I am facing challenge to run more than two slave devices (VL53l8cx sensors). I am getting failure in vl53l8cx_init() call, means failing to upload firmware in VL53l8cx sensors.
2025-07-08 12:30 AM
Hello @SHUBHAM8922 and welcome to the community,
When you said "Does ST supports", what product you were referring to?
2025-07-09 2:34 AM - edited 2025-07-09 2:35 AM
Well, the whole point of SPI as a bus is precisely that the chip selects are there to allow selection of one slave from many.
If it works for two, then I don't see why it should not work for more than two.
Look into your implementation and check that you are correctly selecting only one slave at a time...
@SHUBHAM8922 wrote:I am getting failure in vl53l8cx_init() call,
So have you stepped into that call to see exactly what's going wrong?
Have you looked at what's happening on the wires using an oscilloscope or analyser?
Please give a full description of your setup:
See: How to write your question to maximize your chances to find a solution.
2025-07-09 2:45 AM
Currently i am using STM32F401re controller and want to control three VL53l8cx sensor using single SPI bus using multiple chip select. The issue is that, when 3 VL53l8cx sensors are connected, there is a random behavior that one, two or all 3 VL53l8cx sensors are failing at vl53l8cx_init() call. My question is does ST provides any example code to run multiple devices on single spi ?(i see most of the examples provided are i2c based). More info: currently i am using ST provided code base with no OS.
2025-07-09 8:21 AM
How are you connecting the satellites to the f401 ? Is it through the x-Nucleo or are you using flying wires to connect the satellites to the f401 ?
2025-07-09 11:58 PM
I am using jumper wires to connect the vl53l8cx sensors.
2025-07-10 1:34 AM - edited 2025-07-10 1:35 AM
You still haven't said what boards you are using.
You still need to show the schematic of the connection.
You still need to show the code.
Some good, clear photos of your setup would also help.
Have you looked at what's happening on the wires using an oscilloscope or analyser?
In particular, have you verified that the chip selects are correct?
Jumper wires can be unreliable - so you really need to check at the STM32 pins and at the VL53l8cx pins that the signals are getting through, and are clean.