cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple VL53l8cx sensors on single SPI bus using multiple chip select?

SHUBHAM8922
Associate

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.

6 REPLIES 6
mƎALLEm
ST Employee

Hello @SHUBHAM8922 and welcome to the community,

When you said "Does ST supports", what product you were referring to?

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.
Andrew Neil
Super User

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:

  • boards used
  • schematics
  • code used
  • etc

See: How to write your question to maximize your chances to find a solution.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

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.

Anne BIGOT
ST Employee

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 ?


Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised.

ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'

I am using jumper wires to connect the vl53l8cx sensors.

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.

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.