title: ESP32 failing to detect PN532 NFC module
body: <p>I've been struggling for the past few days to get the Elechouse PN532 V3 module working with an ESP32 over I2C. The PN532 module itself works fine with a Raspberry Pi.</p>
  
  <p>This is the circuit (not actually using SparkFun ESP32 board, just for reference)
  <a href="https://i.stack.imgur.com/1nDB4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1nDB4.png" alt="ESP32 circuit"></a></p>
  
  <p>And this is the code I'm trying to run</p>
  
  <pre><code>#include &lt;Wire.h&gt;
  #include &lt;PN532_I2C.h&gt;
  #include &lt;PN532.h&gt;
  #include &lt;NfcAdapter.h&gt;
  
  PN532_I2C pn532i2c(Wire);
  PN532 nfc(pn532i2c);
  
  void setup(void) {
    Serial.begin(115200);
    Serial.println("Hello!");
  
    Wire.begin(18, 19);
    nfc.begin();
  
    uint32_t versiondata = nfc.getFirmwareVersion();
    if (! versiondata) {
      Serial.print("Didn't find PN53x board");
      while (1); // halt
    }
  
    // Got ok data, print it out!
    Serial.print("Found chip PN5"); Serial.println((versiondata&gt;&gt;24) &amp; 0xFF, HEX); 
    Serial.print("Firmware ver. "); Serial.print((versiondata&gt;&gt;16) &amp; 0xFF, DEC); 
    Serial.print('.'); Serial.println((versiondata&gt;&gt;8) &amp; 0xFF, DEC);
  
    // Set the max number of retry attempts to read from a card
    // This prevents us from waiting forever for a card, which is
    // the default behaviour of the PN532.
    nfc.setPassiveActivationRetries(0xFF);
  
    // configure board to read RFID tags
    nfc.SAMConfig();
  
    Serial.println("Waiting for an ISO14443A card");
  }
  
  void loop(void) {
    boolean success;
    uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
    uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
  
    // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
    // 'uid' will be populated with the UID, and uidLength will indicate
    // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
    success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &amp;uid[0], &amp;uidLength);
  
    if (success) {
      Serial.println("Found a card!");
      Serial.print("UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
      Serial.print("UID Value: ");
      for (uint8_t i=0; i &lt; uidLength; i++) 
      {
        Serial.print(" 0x");Serial.print(uid[i], HEX); 
      }
      Serial.println("");
      // Wait 1 second before continuing
      delay(1000);
    }
    else
    {
      // PN532 probably timed out waiting for a card
      Serial.println("Timed out waiting for a card");
    }
  }
  </code></pre>
  
  <p>And finally the serial output: <code>Didn't find PN53X board</code><br>
  Any ideas what I'm doing wrong?</p>
  
  <p>EDIT: libraries im using <a href="https://github.com/elechouse/PN532" rel="nofollow noreferrer">https://github.com/elechouse/PN532</a> and the ESP32 dev board is a Wemos Lolin32 Lite clone.</p>