PN532 sometimes not responding with ESP32

Im using ESP32 with PN532 NFC module with I2C
And Im using this library GitHub - elechouse/PN532: NFC library for Arduino using PN532
And using this documents https://www.elechouse.com/elechouse/images/product/PN532_module_V3/PN532_%20Manual_V3.pdf

Normally, it finds the PN532 and reads the card successfully when I scan it. However, sometimes after starting, it doesn't detect the PN532 and never finds it.It say PN53x card not found!. When I unplug and plug in the sensor cable, the ESP32 can detect the sensor, but I shouldn't have to do it this way. Therefore, if it can't find the PN532 twice, I wanted to reset it as follows:

void resetPN532() {
digitalWrite(PNP532_IRQ_Pin, LOW);
delay(100);
digitalWrite(PNP532_IRQ_Pin, HIGH);
delay(100);
digitalWrite(PNP532_RSTO_Pin, LOW);
delay(100);
digitalWrite(PNP532_RSTO_Pin, HIGH);
 }

This is code for the find:

`  uint32_t versiondata = nfc.getFirmwareVersion();
  
  if (Serial.available() > 0) {
  processCommand("command");
  }

  if (!versiondata) {
    Serial.println("PN53x card not found!");
    resetCounter++;
    if (resetCounter >= 2) {
      Serial.println("Reset PNP");
      resetPN532();
      resetCounter = 0;
    }


    return false;
  }

`

This is my connections:
enter image description here

Why I faced with this issue I dont know but how can I solve this problem ?

. When I unplug and plug in the sensor cable, the ESP32 can detect the sensor, but I shouldn't have to do it this way. Therefore, if it can't find the PN532 twice, I wanted to reset it as follows:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.