MFRC522 & SD module don't work simultan

Hi

I have mfrc522 and sd card module for Arduino. I connect them properly.
I use MFRC522.h for mfrc and SD.h build in Arduino ide. And when I connect module sepaetly they work properly. But when I connected them together and set different SS_pIN for them (8 for mfrc and default 4 for SD, nothing of module work. None of this module sends any response. And I don't know why !!!!
My cod is here:

P.S.
I have this module:

They work separately. Good. Did You use SS_pIN 8 for mfrc and pIN 4 for SD when You tested them separately?

Please attach the code here using code tags. Many helpers can't read Your code this way.

The SD sketch, with only the SD connected, works.
The MFRC522 sketch, with only the MFRC522 connected, works.

Connect both devices.

Try the SD sketch after adding adding these lines to the top of setup():

    pinMode(8, OUTPUT);
    digitalWrite(8, HIGH);  // Set the MFRC module to NOT SELECTED

Does it work?

Try the MFRC522 sketch after adding these lines to the top of setup():

    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);  // Set the SD module to NOT SELECTED

Does it work?

If neither of those work, the problem appears to be a hardware conflict and you may have to buy different modules.

johnwasser:
The SD sketch, with only the SD connected, works.
The MFRC522 sketch, with only the MFRC522 connected, works.

Connect both devices.

Try the SD sketch after adding adding these lines to the top of setup():

    pinMode(8, OUTPUT);

digitalWrite(8, HIGH);  // Set the MFRC module to NOT SELECTED



Does it work?

Try the MFRC522 sketch after adding these lines to the top of setup():


pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);  // Set the SD module to NOT SELECTED



Does it work?

If neither of those work, the problem appears to be a hardware conflict and you may have to buy different modules.

The code above didn't change anything. Only if I remove SD.begin(4) lines from setup() my mrfc module start working.
I try to upload solution with setting SS_PIN to HIGH and LOW for the relevant modules but it isn't changing anything.
Also look, that my mrfc card reader only if read properly ID form tag try write something info to sd card. Maybe here is problem\error?
Or i should use any other library for mrfc?

Szwarceneger16:
The code above didn't change anything. Only if I remove SD.begin(4) lines from setup() my mrfc module start working.

I think you did not understand me. I said "Try the MFRC522 sketch". That means the sketch you used to test the MFRC522 module. The sketh that worked? It should have no "SD.begin(4);" in it.

johnwasser:
I think you did not understand me. I said "Try the MFRC522 sketch". That means the sketch you used to test the MFRC522 module. The sketch that worked? It should have no "SD.begin(4);" in it.

Ok, I added this code to both sketch and SD sketch work correctly, but mfrc have problem, not work and sketch display at Serial monitor WARNING "Communication failure, is the MFRC522 properly connected?".
So, what I should do now?

Szwarceneger16:
Ok, I added this code to both sketch and SD sketch work correctly, but mfrc have problem, not work and sketch display at Serial monitor WARNING "Communication failure, is the MFRC522 properly connected?".
So, what I should do now?

So it sounds like the SD module, even when SD_SS is set HIGH (NOT selected), is interfering with the MFRC module. Often this happens when the SD module uses simple buffers for level shifting and is not disconnect from MISO when SD_SS is HIGH. MISO is the Master In - Slave Out line that carries data from the slave to the master. If the SD module is driving that line when the MFRC module is trying to communicate then the data will be corrupted.
I think you should try a different model of SD Card module.

johnwasser:
So it sounds like the SD module, even when SD_SS is set HIGH (NOT selected), is interfering with the MFRC module. Often this happens when the SD module uses simple buffers for level shifting and is not disconnect from MISO when SD_SS is HIGH. MISO is the Master In - Slave Outline that carries data from the slave to the master. If the SD module is driving that line when the MFRC module is trying to communicate then the data will be corrupted.
I think you should try a different model of SD Card module.

Ok, thank for your help. Could you recommend me some module Sd card which should work properly? Maybe you have experience work with that sd module.