UPDATE
I have managed to get rid of the WARNING: Communication failure, is the MFRC522 properly connected?
. Unfortunately, that did not fix the firmware error it now says 0x80
. I have now also tried using different IDEs from arduino in the hopes of fixing this, still nothing. The connection error between the reader and the arduino has come back as well.
Furthermore...
*****************************
MFRC522 Digital self test
*****************************
Firmware Version: 0x92 = v2.0
-----------------------------
Only known versions supported
-----------------------------
Performing test...
-----------------------------
Result: DEFECT or UNKNOWN
would this now mean that my device is a defect?
Also, that version has gone back to showing unknown
and the other hexadecimal codes.
I have just bought the parts. The arduino nano v3 and the MFRC522 based RFID reader. I have followed the typical pin layout after downloading the library from arduino. When I go to test one of the examples I get a warning within the arduino serial monitor :
Firmware Version: 0xFF = (unknown)
WARNING: Communication failure, is the MFRC522 properly connected?
Scan PICC to see UID, SAK, type, and data blocks...
I try to scan one of the existing cards but nothing happens. It either stats that it is version 0xFF
or 0x0
. I am new with this and this is my first 'project'. the pins are defined.enter image description here
I have 3.3V on the reader to 3v3 on the arduino I have RST on the reader to D9 on the arduion I have GND on the reader to GND on the arduino (on the same side as the 3v3 is ) I have MISO on the reader to D12 on the arduino I have MOSI on the reader to D11 on the arduino I have SCK on the reader to D13 (on the same side as the 3v3 is) I have SDA on the reader to D10 on the arduino
The code I am using is from the arduino library manager:
/*
* --------------------------------------------------------------------------------------------------------------------
* Example sketch/program to test your firmware.
* --------------------------------------------------------------------------------------------------------------------
* This is a MFRC522 library example; for further details and other examples see: https://github.com/miguelbalboa/rfid
*
* This example test the firmware of your MFRC522 reader module, only known version can be checked. If the test passed
* it do not mean that your module is faultless! Some modules have bad or broken antennas or the PICC is broken.
* NOTE: for more informations read the README.rst
*
* @author Rotzbua
* @license Released into the public domain.
*
* Typical pin layout used:
* -----------------------------------------------------------------------------------------
* MFRC522 Arduino Arduino Arduino Arduino Arduino
* Reader/PCD Uno/101 Mega Nano v3 Leonardo/Micro Pro Micro
* Signal Pin Pin Pin Pin Pin Pin
* -----------------------------------------------------------------------------------------
* RST/Reset RST 9 5 D9 RESET/ICSP-5 RST
* SPI SS SDA(SS) 10 53 D10 10 10
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
*/
#include <SPI.h>
#include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
/**
* Check firmware only once at startup
*/
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 module
Serial.println(F("*****************************"));
Serial.println(F("MFRC522 Digital self test"));
Serial.println(F("*****************************"));
mfrc522.PCD_DumpVersionToSerial(); // Show version of PCD - MFRC522 Card Reader
Serial.println(F("-----------------------------"));
Serial.println(F("Only known versions supported"));
Serial.println(F("-----------------------------"));
Serial.println(F("Performing test..."));
bool result = mfrc522.PCD_PerformSelfTest(); // perform the test
Serial.println(F("-----------------------------"));
Serial.print(F("Result: "));
if (result)
Serial.println(F("OK"));
else
Serial.println(F("DEFECT or UNKNOWN"));
Serial.println();
}
void loop() {} // nothing to do
-
This happens when you wrongly interconnect the pins. are you using i2c comm ?Mitu Raj– Mitu Raj2018年01月12日 17:26:02 +00:00Commented Jan 12, 2018 at 17:26
-
Or SPI communication ?Mitu Raj– Mitu Raj2018年01月12日 17:26:20 +00:00Commented Jan 12, 2018 at 17:26
-
What are they? I am really new to thismorgan– morgan2018年01月12日 17:27:59 +00:00Commented Jan 12, 2018 at 17:27
-
The communication method used by your module with arduino. Its either SPI or I2C. This error happens when these comm. pins are wrongly connected.Mitu Raj– Mitu Raj2018年01月12日 17:29:22 +00:00Commented Jan 12, 2018 at 17:29
-
I am not sure what one it uses, I just connected the pins directly to each other using F-F jumper cablesmorgan– morgan2018年01月12日 17:33:50 +00:00Commented Jan 12, 2018 at 17:33
1 Answer 1
You are using SPI comm. The code is fine too. Usually this "communication failure" happens due to wrong pin connections. Say for eg. If MOSI and MISO are interchanged. Check all connections, ground and VCC connections once more. I have also seen that soldering the pins of MFRC522, instead of simply connecting by wire has solved this issue most of the time. Another work around is repeatedly calling PCD_init() function even after failing result inside loop() . And see whether its working. If none of these worked, hard luck. I think its firmware issue or defective board.
-
Ugh... Looks like I have a faulty board :( Thank you for your helpmorgan– morgan2018年01月13日 10:17:47 +00:00Commented Jan 13, 2018 at 10:17
-
Anyway try both the methods...especially soldering method. These are really delicate and cheap modules. Lotta defective boards are there in the market.Mitu Raj– Mitu Raj2018年01月13日 10:21:04 +00:00Commented Jan 13, 2018 at 10:21