using two rfid(RC522) modules in one project

Hello everybody.
I have this little project that it must have 2 rfid modules in it. just think of a door that needs to have 2 rfid readers in both sides of it. i am using an arduino mega 2560. the problem i’m having is that i can’t use both of these modules together.

the wiring:

the two modules SCK, MISO, MOSI pins are connected to each other and connected to arduino mega pins 52, 50, 51 accordingly.

and the sda and rst pins are in the code:

code :

#include <MFRC522.h>
#include <SPI.h>

const int rst1=22, sda1=23;
const int rst2=32, sda2=33;



MFRC522 rfid1(sda1, rst1);
MFRC522 rfid2(sda2, rst2);



void setup() {
    Serial.begin(9600);
    SPI.begin();
    rfid1.PCD_Init();
    rfid2.PCD_Init();
    delay(1000);
    Serial.println("Program is ready!");
}

void loop() {
    String id="";
    
    if (rfid1.PICC_IsNewCardPresent()) {
        if (rfid1.PICC_ReadCardSerial()) {
            Serial.println("rfid1 has read a card:");
            Serial.print("ID: ");
            for (byte i=0; i<rfid1.uid.size; i++) {
               id+=rfid1.uid.uidByte[i]; 
            }
            Serial.println(id);
            delay(1000); 
        }
        
    }

    if (rfid2.PICC_IsNewCardPresent()) {
        if (rfid2.PICC_ReadCardSerial()) {
            Serial.println("rfid2 has read a card:");
            Serial.print("ID: ");
            for (byte i=0; i<rfid1.uid.size; i++) {
               id+=rfid2.uid.uidByte[i]; 
            }
            Serial.println(id);
            delay(1000); 
        }
        
    }
    
   
}

i don’t know why, but only the rfid1 module is working and the rfid2 does nothing. please tell me what i can do about this and what am i doing wrong.

thank you in advance.

If you swap the two modules does still the rfid1 module work?

Post a sharp photo of your setup!