blushi
Posts: 19
Joined: Tue Jul 14, 2015 3:53 pm

SPI bus and distance

Tue Mar 29, 2016 5:41 pm

Hello everyone,

My project includes 4 RFID-RC522 that have to be read at the same time by one single Raspberry Pi, I disable the pin CE0, CE01 that are usually used for slave select and I use instead regular GPIO pins set as outputs. I put them in low state to read/write and them put them back in high state after the data transfer. CLK and RST are shared among the 4 readers.
I first built this setup using breadboard and short jumper wires and it was working fine. Now I have built a more durable setup with longer wires because the RFIDs have to be placed at a certain distance to each other. The total chain, from master MOSI, through the slave RFID readers, to master MISO, is 3-4m long. But it is not working anymore and I cannot detect any tags...

I have already gone through several forums and these are some ideas I have found:
- lower SPI bus speed: which baud rate would be appropriate?
- use shielded wires.
- use separate power supplies: I am currently using the same 3.3V rail for the 4 readers, maybe this might help to use separate 3.3V supplies.
- use the smallest gauge wire for the data lines: I am currently using 24AWG, maybe this is not thin enough.

If you have any comments regarding the above ideas or any additional advice, I would be glad to hear them!
Thanks :)

Marie
Last edited by blushi on Wed Mar 30, 2016 11:01 am, edited 1 time in total.

rzusman
Posts: 346
Joined: Fri Jan 01, 2016 10:27 pm

Re: SPI bus and distance

Tue Mar 29, 2016 5:51 pm

SPI isn't designed for long distance - the intent was on-board communications between ICs.
You could try lowering the baud rate until it started working, but you are better off using a different communications scheme, like RS422 or RS485.

edo1
Posts: 136
Joined: Sun Jun 15, 2014 3:33 pm
Location: Russia

Re: SPI bus and distance

Tue Mar 29, 2016 8:27 pm

RPI is cheap enough, you can use several RPIs and connect them through ethernet.

or you could google for long distance SPI solutions like
http://e2e.ti.com/blogs_/b/analogwire/a ... technology

blushi
Posts: 19
Joined: Tue Jul 14, 2015 3:53 pm

Re: SPI bus and distance

Wed Mar 30, 2016 7:20 am

I knew SPI was not designed for long distance communication but I actually did not really know what "long distance" could mean in this case. Thanks for your answers guys. This is what I needed: external opinions to know if it was worth it to try to start working on solutions to fix the problem in itself.
edo1 wrote:RPI is cheap enough, you can use several RPIs and connect them through ethernet.

or you could google for long distance SPI solutions like
http://e2e.ti.com/blogs_/b/analogwire/a ... technology
Or if it would be better just to take a different approach, such as simply using additional RPis. I think that's what I am going to do in the end since i already have multiple RPis connected together through ethernet.

User avatar
TonyD
Posts: 447
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: SPI bus and distance

Wed Mar 30, 2016 10:17 pm

As others have said, 3 to 4 meters distance is too much for SPI but if you use "buffer" chip to improve the wire/cable drive performance and a bit of experimentation you might get it to work in your situation.

TI have a technical note on it:

http://www.ti.com/lit/an/slla142/slla142.pdf
Tony

Return to “Interfacing (DSI, CSI, I2C, etc.)”