Struggling with RC522, SPI and NRF24L01 on Arduino

I have been working for weeks trying to get past this problem. Any insights on this would be tremendously appreciated as I am at my wits end, I have to get past this problem or find a work around.

I have both an RC522 (RFID Tag reader) and an NRF24L01 both connected via SPI to an UNO R3.
I can get either device working well separately, but when combined then I get REALLY inconsistent behavior.
80% of the time nothing works (neither RF reader nor NRF24L01), 10% of the time one or other device works, 10% of the time both devices work (until I restart the arduino and repower the radio).

I have tried multiple different UNOs, Readers, and Radios and configurations but have not been able to get things working.

I understand the basics of how SPI is supposed to work, with the CS being put active Low for the device I am trying to activate and shared CLK, MISO and MOSI lines.

Note: The NRF section of the code can open up one of 6 separate pipes for reading / writing. (As my end project will have multiple remote stations and 1 central controller listening for inputs from the various remote stations)

The way that the loop works:

  1. Scan RFID
  2. Turn on Radio Writing
  3. Send Message
  4. Turn radio to listening for 2 seconds
  5. Process received messages
  6. Based on received message - Turn on LED's, display message etc. (FUTURE)

I have put the code to try to move between RFID and NRF into functions at the end of the code.

Attached is the circuit that I have been tinkering with.

Enclosed is relevant code.

With the RFID connected when I look at the Radio.PrintDetails() all that I get is 0's for the radio details.

I dont get any different behaviours regardless of whether the pullup resistors is in place or not.

Most of the time the program sits there saying "Scan RFID"

Again - thanks anyone for help / insights you can provide.

GamePadv7.ino (21.4 KB)

https://datasheet.octopart.com/A000066-Arduino-datasheet-38879526.pdf - try powering your uno as suggested here might help

Thanks chunkycorgi. I originally suspected that it may be a power related problem, so I tried powering the peripherals (RFID reader and NRF Radio) off of an external power supply but was getting the same problems.

I have also tried powering the UNO via the barrel port and using an i2c LCD instead of the serial monitor. I was getting the same results so I am not convinced it is necessarily a power related problem. (More likely code)

what was the voltage/current ratings of the barrel jack supply? The recommended supply is 7-12v
I doubt your missing bits of the code so its hard to help. For example you say 'Most of the time the program sits there saying "Scan RFID"' but then have the below code in your loop

 bool WaitRFID = TRUE ;   // Bool wait for RFID to get scanned
  while (WaitRFID) {       // loop for RFID
   ...WaitRFID is never changed here...
  }

chunkycorgi:
what was the voltage/current ratings of the barrel jack supply? The recommended supply is 7-12v
I doubt your missing bits of the code so its hard to help. For example you say 'Most of the time the program sits there saying "Scan RFID"' but then have the below code in your loop.

 bool WaitRFID = TRUE ;   // Bool wait for RFID to get scanned

while (WaitRFID) {       // loop for RFID
  ...WaitRFID is never changed here...
 }





The power supply was rated at 9V. (2.5A.) Because of the posting length limit I took a knife to the code to shorten it. I have edited the original post to include the full codebase.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.