2024-06-24 12:15 AM
Hello,
I am trying to interface a TI MCU with three LSM6DSV16X sensors using SPI communication on the same bus.
My setup consists of 3 chip select lines with a 10 kΩ pull-up resistor (on all sensor boards), POCI (MISO) with a single 10 kΩ pull-up resistor (on 1 sensor board), PICO (MOSI) and the CLOCK line with nothing, with a long distance shown on the schematic (attached file). All sensors are powered with 3.3V.
I am facing an issue that I can't solve. This setup seems to be unreliable, as I can't consistently read all three chips correctly.
My flow is as follows:
For some reason, most of the time I can read 0x70 on two chips, but the third one shows different behaviors. The most frequent responses I get are 0x00, 0x60, or sometimes 0x70.
To address this anomaly, I have experimented with multiple things, but all seem to have the same results as before:
I should mention that I have tested all of the chips independently, and they work perfectly even with around 2 meters of cables, using the same flow as explained above.
Additionally, we have used an oscilloscope to observe the signals, and all signals are correct in the sense that they are synchronized, the voltages are correct, signal noise is very low, and no misalignment could be identified. What I read on the oscilloscope from the sensor board matches what I read and send with the microcontroller.
Do you have any ideas of what could cause this issue and how it could be fixed?
2024-07-11 03:02 AM
Hi @Nico5 ,
Welcome to ST Community!
Maybe can be an interference on the communication, have you checked that no other CS are enabled when communicate with third device?
Do you check on pinout linking? Micro pin are correctly linked to pin CS, SCL, SDA also for third device?
If you wait some ms between the communication with the other 2 sensor and the third one, the response continue to be unstable?
2024-07-11 03:53 AM
Hi,
first idea with your setup: hardware problem. (EMI, bad GND...etc.)
Try connecting with a screened cable, maybe a CAT5 patch cable ;
screen is GND , 8 lines : clk, miso, mosi , 3x CS , 2 x VCC (3.3V ) ; so no other gnd or vcc wires to the modules.
Maybe just 3 patch cables , one to every sensor; connected at master/cpu ; (then could be only one CS in every cable).
And to avoid ringing or reflections, dont drive the lines with (master cpu) pin-high-speed-setting or/and insert some 51...100 ohms resistors in all lines at the master.
Try...
2024-07-11 04:05 AM
SPI really isn't designed for long distances like this - it's intended for communication between chips on the same bord.
2024-07-11 05:48 AM
Depends...same holds for all communication lines. :)
Usually -e.g.- on serial you have a driver/transceiver, and then the line (same for all others also).
If no transceiver , then you always have the problems : EMI/spikes coming in + producing EMI(if using unscreened lines).
btw In my experience with STM cpus the I2C is the bad guy. Never works without problems and errors.
SPI : i have running on 50cm CAT5 cable (sceened) at 24Mbit, no problem.