1

Im using ESP32 with PN532 NFC module with I2C And Im using this library https://github.com/elechouse/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:

4
  • the code does not compile without error Commented Nov 16, 2023 at 7:34
  • I share the part of the code. Not all of them Commented Nov 16, 2023 at 7:35
  • @jsotola what you mean? Commented Nov 16, 2023 at 7:54
  • " PN53x card not found" basically means it can't establish a communication with PN53x. You need to check your wiring, your power supply, your noise, and your code. to find out the root cause. If the sensor can't be found, how can you be sure that you can reset it via software? You got one problem in establishing a communication, instead of finding the root cause, now you got two problems. Commented Nov 17, 2023 at 16:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.