Go Down

Topic: MFRC-522 on Arduino Due (Read 808 times) previous topic - next topic

Vvamp

Jul 11, 2019, 02:10 pm Last Edit: Jul 11, 2019, 02:27 pm by Vvamp
So, I bought a MFRC-522 rfid reader for a school project and I wanted to test if everything worked, so I installed this library and ran the example. It told me it didn't find a board and after reading stuff online, I figured it was a problem with the pins and/or configured pins in the code. I'm quite new to arduino's and SPI pins, but this is the code and my setup.

code:
Quote
#include <MFRC522.h>
#include <SPI.h>

#define SAD 10
#define RST 5

MFRC522 nfc(SAD, RST);

void setup() {
  SPI.begin();
  Serial.begin(115200);

  Serial.println("Looking for MFRC522.");
  nfc.begin();

  uint8_t version = nfc.getFirmwareVersion();
  if (! version) {
    Serial.print("Didn't find MFRC522 board.");
    while(1); //halt
  }

  Serial.print("Found chip MFRC522 ");
  Serial.print("Firmware ver. 0x");
  Serial.print(version, HEX);
  Serial.println(".");
 
  if (nfc.digitalSelfTestPass()) {
      Serial.print("Digital self test by MFRC522 passed.");
  } else {
      Serial.print("Digital self test by MFRC522 failed.");
  }
}

void loop() {

}
picture of my setup is attached(the picture might be unclear, but basically I connected SS to pin 10, SCK to SCK2, RST TO RESET2, MISO to MISO2 and MOSI to MOSI2 on the SPI pin block. The 3.3v and GND are connected to the general 3.3v and GND pins.


I'm not sure what to do, I looked at the pin reference and looked at similar threads, but most are for the arduino uno. I tried using the pins from the pin reference, but I can't find the pin number for the RESET pin. Which I am guessing I need for the code? Any help is appreciated!

weird_dave

There's another SPI header on the Due, which is the 'normal/usual' SPI connection, definitely start there.


Vvamp

Oh I didn't even notice, I'll have a look, thanks!

Vvamp

Yes that worked, thank you!!!

I read somewhere online I had to use the SCPI pins, but I guess that was incorrect as now it worked first try. You may've saved me an extra year in uni.

Go Up