Friday, 18 May 2018

Raspberry PI's SPI over RS485


I'm trying to understand how to connect a SPI device (a mifare RC522 RFID board) over long distance to my RPi via SPI.


I searched and find I could connect those via SPI over RS485 using a MAX490. (http://forum.arduino.cc/index.php/topic,93234.0.html)


Could anyone explain, maybe with a schematic, how to connect those devices? And do I need some software changes?



Answer




The single-ended SPI signals can be converted to differential pairs, which are more robust in presence of EMI and can go the distance. Then the differential pairs can be converted back to single-ended SPI signals, and connected directly to peripherals (ADC, I/O expanders, and such). That's what the original forum post is proposing.


MAX490 has 2 different sub-circuits.
One sub-circuits is a differential bus transmitter. It can convert a normal single-ended SPI signal to a differential signal.
The other sub-circuit is a differential bus receiver. It can convert a differential signal back to single-ended.


enter image description here (fig. 2 in the datasheet)
enter image description here


In order to connect the SPI bus this way, 3x MAX490 would be required on each side. Something like this.


enter image description here



The above approach has a clock delay problem. So it has limitation in bus length and bit rate. This is what @Andy was referring to in his comment.



Here's an application note that further explores clock delay and proposed a solution (and this one too). However, that solution requires 2 separate SPI peripherals on the microcontroller.


Here's another app note on clock delay in the context of high speed SPI.


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...