Two RC522 I2C

Hello,
How can I use two of the RC522 with i2c bus? My library: GitHub

I did try to make a second MFRC522 class and duplicated the code.

So my try:

#include <Wire.h>
#include "MFRC522_I2C.h"

#define RST_PIN 2

MFRC522 mfrc522(0x2B, RST_PIN); 
MFRC522 mfrc522_2(0x28, RST_PIN);

void setup() {
  Serial.begin(115200);           
  Wire.begin();
  mfrc522.PCD_Init();
  mfrc522_2.PCD_Init(); 
  ShowReaderDetails();
  ShowReaderDetails_2();
  Serial.println(F("Scan UID"));
}

void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent() || ! mfrc522.PICC_ReadCardSerial() ) {
    return;
  }
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    Serial.print(mfrc522.uid.uidByte[i], HEX);
  } 
  Serial.println();

if ( ! mfrc522_2.PICC_IsNewCardPresent() || ! mfrc522_2.PICC_ReadCardSerial() ) {
    return;
  }

  for (byte i = 0; i < mfrc522_2.uid.size; i++) {
    Serial.print(mfrc522_2.uid.uidByte[i], HEX);
  } 
  Serial.println();  
}

void ShowReaderDetails() {
  byte v = mfrc522.PCD_ReadRegister(mfrc522.VersionReg);
  Serial.print(F("MFRC522 Software Version: 0x"));
  Serial.print(v, HEX);
  if (v == 0x91)
    Serial.print(F(" = v1.0"));
  else if (v == 0x92)
    Serial.print(F(" = v2.0"));
  else
    Serial.print(F(" (unknown)"));
  Serial.println("");
  if ((v == 0x00) || (v == 0xFF)) {
    Serial.println(F("WARNING: Communication failure, is the MFRC522 properly connected?"));
  }
}

void ShowReaderDetails_2() {
  byte v = mfrc522_2.PCD_ReadRegister(mfrc522_2.VersionReg);
  Serial.print(F("MFRC522 - 2  Software Version: 0x"));
  Serial.print(v, HEX);
  if (v == 0x91)
    Serial.print(F(" = v1.0"));
  else if (v == 0x92)
    Serial.print(F(" = v2.0"));
  else
    Serial.print(F(" (unknown)"));
  Serial.println("");
  if ((v == 0x00) || (v == 0xFF)) {
    Serial.println(F("WARNING: Communication failure, is the MFRC522 - 2  properly connected?"));
  }
}

The UIDs of the first device (0x2B) came up quickly, but the second device (0x28) made no output. Only if I put an nfc card on the first device, then came out an output.

Where is the problem?

You must use different RST pins for the two chips otherwise they disturb each other by resetting them to often.

I tested it out with different reset pins. But the phenomenon is the same.

Did you run an I2C scanner on your hardware setup? Does it see both devices? Otherwise your hardware setup is wrong.