Skip to main content
Visitor II
March 24, 2022
Solved

What is the maximum distance supported by the SPI bus to connect an LSM6DSOX?

  • March 24, 2022
  • 2 replies
  • 11861 views

Hello,

I am trying to use an LSM6DSOX through SPI communication, but I am having some problems due to the length of the cable. I'm using a cable about 2 m long but the sensor is not working well. I have tried using different LSM6DSOX chips but the result is always the same, sometimes information is lost in the sensor response and other times it generates interference with another sensor that is connected to the same SPI bus (a MAX30003 ECG sensor).

I suspect that the problem is caused by the cable length because I have also tried using a shorter cable (about 30 cm) and there is not problem with that configuration. Therefore, I want to know what is the maximum distance supported by the SPI bus to connect this sensor and also what could you suggest me to avoid the communication problems when using a long cable to connect the sensor to the master device.

Additional information:

  • I am using a Raspberry Pi 3 model B as master device.
  • The sensor has the suggested configuration with the decoupling capacitors as near as possible to the LSM6DSOX chip.
    This topic has been closed for replies.
    Best answer by Peter BENSCH

    You will find a lot of discussion on this topic on the net if you search for "spi cable length". Developed for short-distance communication, SPI does not use differential, but single ended signalling, also with quite a high frequency and must also comply with timings so that it can synchronise. All this becomes more and more susceptible to interference and unreliable as the cable length increases. If there are other high-speed lines nearby or even in parallel, this is further exacerbated.

    You could experiment by using a different cable to the sensor, e.g. a shielded one, to at least minimise the interference. Unfortunately, such a shielding, especially if it is realised per wire, increases the delays due to its capacitive effect.

    As you can see, it is not an easy task to route SPI over long distances.

    Does it answer your question?

    Good luck!

    Regards

    /Peter

    2 replies

    Technical Moderator
    March 24, 2022

    You will find a lot of discussion on this topic on the net if you search for "spi cable length". Developed for short-distance communication, SPI does not use differential, but single ended signalling, also with quite a high frequency and must also comply with timings so that it can synchronise. All this becomes more and more susceptible to interference and unreliable as the cable length increases. If there are other high-speed lines nearby or even in parallel, this is further exacerbated.

    You could experiment by using a different cable to the sensor, e.g. a shielded one, to at least minimise the interference. Unfortunately, such a shielding, especially if it is realised per wire, increases the delays due to its capacitive effect.

    As you can see, it is not an easy task to route SPI over long distances.

    Does it answer your question?

    Good luck!

    Regards

    /Peter

    Visitor II
    March 25, 2022
    1. What speed is your SPI? Try reducing it (5Mbps > 1Mbps > 100Kbps...slower). How fast do you really need the data to be?
    2. Does your sensor have any other interfaces that are better for longer cables (UART/RS232/USB...). SPI is typically used within a single PCB, or at least within an enclosure, it was never intended for a 2m cable.
    3. Shielded cable may help, but reducing the datarate will probably still be required.
    4. Does your sensor include any error detection in its SPI Data? (CRC, Parity, etc). Few SPI IC have such. If not then for reliability absolutely minimize the cable length or you won't be able to trust the data.

    Paul