1

I was trying for one month to make multiple RC522 rfid readers work together on SPI on an arduino yun, one works fine, but if I plug 4, each with a specific slave select, only one, sometimes 2, sometimes none are working.

The library i use is RFID.h (i think the miguelbalboa one) , but I had the same results with MFRC522.h wich have a specific readUidMultiReader so I dont think my code is at fault.

Searching for this issue, I found this question wich is basically my issue, as I suspect the readers I bought are not supporting multidrop. These readers dont work either.

I read about solutions using multiplexers for SPI lines, tristate buffers on miso lines and/or diodes but these are workarounds, and there should be a more straightforward solution.

Also I tested with no resistors most of the time, but tried putting 10kΩ from all MISO to 3v3, no change, as i really dont understand what their use are, even if I feel they could be mandatory.


I am using a yun for the builtin ethernet, because I tried nanos with ethernet shields and again the shields are ignoring the Slave select and thus not working with spi multidrop, so each time I plugged the shield on nano, even not using it, rfid stopped working.

wiring

2
  • your note about Ethernet shield makes me think you don't set all CS pin HIGH before begin() the individual devices in setup()
    – Juraj
    Commented Feb 27, 2020 at 14:20
  • 1
    I have the same problem. Did you find a solution ? how to put HIGH the CSin the code ? Best regard. Commented Dec 31, 2020 at 9:41

2 Answers 2

1

Multiple SPI devices on the same bus shouldn't be a problem. I would try the following steps to narrow down the problem:

  1. Add Pull-Up resistors to each CS line (10k should be enough)
    (The is no need for resistors on the MISO, MOSI or CLK lines since they a push/pull when active)

  2. Make sure each CS is set to HIGH before you attempt to access the reader

  3. Use a simple sketch that only access 1 reader.

    • if you could access the first reader -> change the sketch to use the second one without changing the hardware setup. Continue until you've checked all readers.
    • if you are not able to communicate with one reader, you still have a bug in your hardware setup
  4. When the readers work independently, you could start to write your sketch using more than one at a time. (depending on the libraries this could be quite difficult since the lib must support multiple instances, but first we should check the hardware setup)

0

I suppose that digital output power from yun is insufficient to drive all four readers - so, you need to add some digital buffers to MOSI, SCK, and RST lines.

74LS07 digital buffer:

74LS07

3
  • can vcc and ground of the digital buffer be the ones of the yun (as they can output more intensity than the pins) or must they be from an external source then ?
    – Neil
    Commented Feb 27, 2020 at 15:26
  • Yes, they can ofk
    – gbg
    Commented Feb 27, 2020 at 21:53
  • You shouldn't need buffers for the SPI lines. The only power needed on these lines is the charge the input capacities on the slaves / master und 5 devices on a bus don't need much current.
    – theSealion
    Commented Feb 28, 2020 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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