Arduino not working with ethernet shield

i’m having trouble reading an rfid tag using mfrc522 rfid module,when the arduino is connected to an ethernet shield.But the mfrc522 reads the rfid tag and displays it in the serial monitor when arduino is not connected with ethernet shield.i hav also tried several ethernet shields the same problem persists…i hav ealso attached my code…

ReadAndWrite.ino (7.61 KB)

Maybe remove or comment out the line

while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)

Try that and see how you go on.

The ethernet shield uses pin 10 as its SPI SS, and that’s the same as you’re using for the rfid.