0
\$\begingroup\$

I'm using several MFRC522 modules which communicate to an arduino with the SPI protocole. The distance between the arduino and the modules will be between 1 and 2 meters.

I'm worried about the distance, I'm not sure of the quality of the SPI signal for a such distance. I would like to know your opinion about using wire like RS422 or RS485.

If I have to use this wiring, could you explain me how to convert SPI to RS422 ?

Thank you ,

\$\endgroup\$
  • \$\begingroup\$ RS-whatever is not a wire, it's a protocol. \$\endgroup\$ – Eugene Sh. Jul 27 '18 at 19:14
  • 3
    \$\begingroup\$ @EugeneSh. Actually, RS-422/RS485 etc are electrical interfaces. The specifications do not define a protocol for them. \$\endgroup\$ – Maple Jul 27 '18 at 19:16
  • \$\begingroup\$ Why SPI at all? These modules have nice conventional UARTs. \$\endgroup\$ – Eugene Sh. Jul 27 '18 at 19:23
  • \$\begingroup\$ @KevHV The best way to convert SPI to other interfaces and back is... drum roll... to Google for it. A quick search gives thousands of links, including on this site: electronics.stackexchange.com/q/357411/187920, electronics.stackexchange.com/a/201993/187920 \$\endgroup\$ – Maple Jul 27 '18 at 19:23
  • \$\begingroup\$ related: Raspberry PI's SPI over RS485 \$\endgroup\$ – Nick Alexeev Jul 27 '18 at 19:24
1
\$\begingroup\$

The SPI can work at 2 meters just fine, although at reduced speed. If you do not absolutely need maximum possible clock you can wire your modules and gradually increase speed to find out error-free maximum.

As a side note, SPI is not the best protocol to use off-board when you have multiple slaves, because wiring CS lines quickly makes it cumbersome.

Using I2C or dI2C simplifies wiring but requires somewhat more complicated transceiver circuits. Using I2C-to-1wire bridges simplifies this as well but at cost of greatly reduced speed.

UART also works at 2m without problems. You can extend it much further by converting UART to RS-485 or LVDS. The problem with using UART, however, is that it does not have addressing mechanism to support multiple modules. If your controller has enough UART ports for all modules then wiring them individually instead of using any bus would be best option.

Note that MFRC522 chip supports all three protocols, SPI, I2C and UART.

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot for your information (and the other helpers too) ! I'm going the carry on my studies on conversion between RS.. and SPI. \$\endgroup\$ – FrancNovation Jul 27 '18 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.