MINI RFID_RC522 not working on Arduino MEGA, but working on UNO

Ok, so I'm finishing my degree's final project and after getting it to work everything in Arduino UNO, my OLED didn't work with everything I had (I think because of the low memory remaining) so I have transferred everything into an Arduino MEGA.

That said, in MEGA I managed to use OLED correctly, but the thing is that now my RFID module is not working.
I know the pin distribution is different, I have it as all tutorials say:

image

As in: https://www.instructables.com/Interfacing-RFID-RC522-With-Arduino-MEGA-a-Simple-/

So, if I use the module on Arduino UNO with its basic program test it works fine, when I use this program test but on the Arduino MEGA it just won't work.

Could it be that this brand is not compatible with MEGA? I'm using MINI RFID-RC522 from MH-ET LIVE I think. Not the common RFID, a mini version or something like that.

What really frustrates me is that it works in UNO but not in MEGA.

Confusingly the table you posted shows SDA as D9 on the Mega but assuming that SDA in this table really means SS then it should be pin D53.
Try moving the D9 wire to D53 and alter the code to reflect this pin change. In theory you can use any pin as SS but IIRC the real SS pin need to be set to output to put the SPI interface into master mode.

Thank you for the response!
Yea, it says SDA in the table but then in the code they say:

/* Define the DIO used for the SDA (SS) and RST (reset) pins. */
#define SDA_DIO 9
#define RESET_DIO 8
/* Create an instance of the RFID library */
RFID RC522(SDA_DIO, RESET_DIO); 

And I also already tried what you said. Using SS in 53 like this:

#include   <SPI.h>
#include   <MFRC522.h>

#define RST_PIN     46    // Pin de reset del modul RFID RC522
#define SS_PIN       53   // Pin SS (Slave Select) del modul RFID RC522

MFRC522   rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  SPI.begin();      // Init SPI bus
  rfid.PCD_Init(); // Init MFRC522 card
  Serial.println("Scan PICC to see UID and type...");
}

And it still doesn't work, I'm waiting for an Az-delivery module to arrive, I hope its the model type that's maybe not working with the MEGA I have. If not, the MEGA's pins should be broken or I still connected things wrong but I don't see how.
Can't see anymore options while it still works on UNO but not on MEGA.

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