RFID-RC522 doesn't get a reading

I got a RFID-RC522 in a starter kit and wanted to put it to use. But when I run my code, it acts like the reader isn't even working.

Here is my code:

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

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance.

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

void loop() {

  mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

my pins are in these locations:

  • Reset 5
  • SPI SS 53
  • SPI MOSI 51
  • SPI MISO 50
  • SPI SCK 52

and I am using this library:

Thanks for your time!

you just forgot to look for and select the card you want to use, try this

if ( ! mfrc522.PICC_IsNewCardPresent()) {
		return;
	}

	
	if ( ! mfrc522.PICC_ReadCardSerial()) {
		return;
	}

	mfrc522.PICC_DumpToSerial(&(mfrc522.uid));

also you may want to look at the example sketches, pretty much the exact same thing is in there :smiley: good luck!

Why are you not using a standard example from that library? There are like 15 standard examples that you can use and they all work.

Thank you guys so much! I got it working! But now I get a different error: "Dumping memory contents not implemented for that PICC type."

When I try to dump the contents of the tag.

it's possible you just have an unsupported card. Did it come with the reader? if not that could be it.
If so it could also be that you accidentally plugged in the power to 5V rather than 3.3V?

it's probably the first problem but check anyways.

NeilSawhney:
it's possible you just have an unsupported card. Did it come with the reader? if not that could be it.
If so it could also be that you accidentally plugged in the power to 5V rather than 3.3V?

it's probably the first problem but check anyways.

NeilSawhney:
it's possible you just have an unsupported card. Did it come with the reader? if not that could be it.
If so it could also be that you accidentally plugged in the power to 5V rather than 3.3V?

it's probably the first problem but check anyways.

I have tried 2 different cards, one was the stock card, which worked, and the other was a Skylander's RFID tag, which was the one that threw the error.

ok then its probably just that the chip in the card isn't compatible

NeilSawhney:
ok then its probably just that the chip in the card isn't compatible

If that's the case, than could you tell me a reader that can dump it?
I do believe that there is an encryption key on the card and I have the key, but I don't know to dump it.

I do believe that there is an encryption key on the card and I have the key, but I don't know to dump it.

You need to get into the libiary and change the key. Currently it is the fixed "default" key of six bytes of 0xFF. You need to change the libiary so that you can pass your key to the read function. Your key will also be a block of six bytes. If it isn't then you haven't got the key.

1 Like