On the ICSP ( in the middle of the board ) is a SD-CARD Reader connected
On Pin 50-53 is a RC522 ( RFID ) connected.
The Card Reader is working without any problem, but not the RC522. He's doing nothing.
Even if I load the sample sketch for the RC522 ( CardReader is still connected on hardware side, but not inside the program ), the RC522 is doing nothing.
Have you separate select pins for the two devices?
There are other Threads about problems with SD Card readers not behaving properly - I think they don't put the SPI system back into the correct state when they are finished. But I don't have one of those readers - just a DIY one that I cobbled together and which does not have a problem.
It may help to call the initialization code for your RC522 device immediately before trying to access it - one of the problems of not being able to see your program!
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 53
#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() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
// Dump debug info about the card. PICC_HaltA() is automatically called.
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}
As you can see, there's no SD Card Reader inside the code. It's only connected on Hardware side.
StefanKDS:
As you can see, there's no SD Card Reader inside the code. It's only connected on Hardware side.
I don't understand. I thought the problem was caused by the combination of the two devices.
And you have not said what I/O pin you are using to select the SD Card reader
In case you are not aware the pins on the ICSP header are directly connected to the SPI pins on the end of the board. I suspect you have both devices using pin 53
You're right. In the end I have to use both devices.
But it was not working so I load only a test for the RC522 on the MEGA, but all other hardware is still connected