Friday, 3 February 2017

rs485 - SPI over long distance


I want to connect chips that use SPI protocol to communicate (To be specific those chips are ws2801) the distance may reach 100 meters.


How can I solve this issue? After a few days of searching I've come up with two solutions:



  1. Using RS485 conversion IC's.

  2. Shifting the voltage to 12V so that it's more immune to noise. I'm not sure how much delay the conversion makes.


Is there any other practical solution?




Answer



I found an interesting read from Texas Instruments here called Extending the SPI bus for long-distance communication by Thomas Kugelstadt. It sounds pretty difficult to just make it work keeping it as SPI, but they do say you can get (up to) 100m+.


I would say, definitely do the SPI-to-RS485 conversion. Use the differential drivers through shielded twisted pair cables to get that 100m distance. This is the sort of task it was designed for.


Maybe even use fiber optics for the RS485 if you want minimal noise or delay problems.


The capacitance of 100m of cable will ruin any attempt at synchronous (clock based) high speed serial protocols like SPI, and making the voltage 12V will make the problem even worse, as the slew rate of the transmitting op-amp will need to be much higher than if it was only driving 3.3 or 5V over the same capacitance, because to change logic state it has to produce more change in voltage on the line.


Differential signals used in RS485 can operate at a nice low level (+-1.5V usually) and still be very fast. RS485 can usually do the standard baud rates up to 4000ft of cable. Because 100m is only around 300ft, you can expect the standard 115200 baud rate to work fine, or maybe even try the higher baud rates if your chips will let you, to squeeze as much performance out of your SPI->RS485 link as possible.


After the RS485 transmission, your LED driver chip can then receive SPI protocol commands from the protocol conversion chip, as if there was nothing betweeen the LED chip and the sender.


There WILL be delays for the SPI-> RS485 -> RS485->SPI conversion (see the datasheets of the protocol conversion chips for these numbers) and of course RS485 has a slower overall bandwidth than SPI. There is an NXP chip "SC16IS752" I found which can do this SPI to RS485 for you, otherwise you could look at doing SPI to UART, then attach a RS485 transceiver ship on the output of the UART before going out onto the cables.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...