Raspberry Pico cannot see I2C NFC PN532 device

I've got the start of my sketch, which I use on my Arduino Uno successfully, but on the Pico it can't find the PN532 (DFRobot) device and therefore I don't get past the message: "Didn't find PN53x board".

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>
#include <Ndef.h>

PN532_I2C pn532_i2c(Wire);
PN532 nfc(pn532_i2c);


void setup()
{    
  Serial.begin(115200);
  Serial.println("<-- STARTING -->");
  
  nfc.begin();
  
  uint32_t versiondata = nfc.getFirmwareVersion();
  while (! versiondata) {
    Serial.print("Didn't find PN53x board");
    delay(1000);
  }
  
  // Got ok data, print it out!
  Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX); 
  Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC); 
  Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
  Serial.println("");
  
  // configure board to read RFID tags
  nfc.setPassiveActivationRetries(3);
  nfc.SAMConfig();
  Serial.println("Waiting for a card to be placed on reader.....");
}

void loop() {
  // put your main code here, to run repeatedly:

}

At first I had the PN532 clock and data wires connected to the wrong pins (GP2, GP3), but moved them to the right ones (GP6, GP7), and was able to verify the device was "seen" by running the I2C scanner posted by John41234 here: scanner sketch.

I've looked as best as I can through the PN532, PN532Interface, and PN532_I2C libraries the best I can, and I'm not seeing any pin number or constant I should be changing to account for the switch from Arduino to Pico.

I'm using the mbed_rp2040 v.2.5.2 platform.

Any ideas I could use to fix this or test would be greatly appreciated.

Try posting a schematic of your circuit as it is wired showing all power and ground connections. A frizzy picture would not help much. Be sure to show all level translation circuits if there are any and post links to technical information on all hardware devices.

Here is a schematic of what I have set up. I could not find the PN532 in the catalog of the online schematic maker, so I chose something close. Let's pretend that D0 pin (connected to GP7) is in actuality the SCL pin, and A0 pin (connected to GP6) is the SDA pin.

image

Following are links to technical information on the NFC PN532:
General Product Page
Product Wiki

You posted a picture with a bunch of colored lines connected to a green board. I do not have a clue as to how it gets its power. A schematic is much more useful than a frizzy picture. Try to draw the schematic yourself. You cannot find the PN532 and you purchased one how will i find one. I found several boards that answer to PN532 but which one? I am not good at pretend games, I usually lose.

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