RC522 arduino MEGA 2560 can't run

i have used mega 2560 and RC522 then i used this code bellow:
/*


  • Example sketch/program to test your firmware.

  • This is a MFRC522 library example; for further details and other examples see: GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522
  • 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 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>

#define RST_PIN 46 // Configurable, see typical pin layout above
#define SS_PIN 53 // 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

But affter run it has result :
Firmware Version: 0x0 = (unknown)
WARNING: Communication failure, is the MFRC522 properly connected?
Scan PICC to see UID, SAK, type, and data blocks...

I don't know why?

1 Like

i have used mega 2560

We know what that is.

and RC522

But not what that is (or, specifically, not which one you are using, whether it is a shield or not, or how it is actually connected).

The chart that was mangled because you did not post your code correctly shows that the reset pin, when the RC522 is used with the Mega, should be pin 5. Why did you choose pin 46?

I am sorry, this is first time i ask question in forum so i don't know how to post exactly.
This is my project:

I have conected with pin 46 but not have signal.