Hello Everyone (Scruff ). I finally have modified my grove nfc v1.1. I currently have this code that is compiling and flashing however i keep receiving "Didn't find PN53x board"
in my terminal . My grove nfc is connected on I2C_1 on the particle grove shield. Please if someone can figure out how to solve this it would be a great day for me !!!1
This is my following code
#define SYSTEM_THREAD(ENABLED)
#include <Adafruit_PN532.h>
#define PN532_I2C_MODE
// #include <Wire.h>
// #define PN532_MODE (PN532_I2C_MODE)
// #define PN532_READY (0x01)
// #define IRQ_PIN (D0) // This is how the PN532 Shield gets ready status in I2C mode
// #define RST_PIN (D1) // Necessary for I2C mode
Adafruit_PN532 nfc(D0,D1);
void setup(void) {
Serial.begin(115200); // Make sure your serial terminal is closed before power the Core.
Serial.println("Hello!");
nfc.begin();
uint32_t versiondata;
do {
versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.print("Didn't find PN53x board\n");
delay(1000);
Particle.process();
}
Particle.process();
}while(!versiondata);
// Got ok data, print it out!
Serial.print("Found chip PN5\n"); Serial.println((versiondata>>24) & 0xFF, HEX);
Serial.print("Firmware ver. \n"); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
// configure board to read RFID tags
nfc.SAMConfig();
}
void loop(void) {
Particle.process();
Serial.println("Waiting for an ISO14443A Card ...\n");
delay(1000);
uint8_t 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, uid, &uidLength);
if (success) {
// Display some basic information about the card
Serial.println("Found an ISO14443A card");
Serial.print(" UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
Serial.print(" UID Value: ");
nfc.PrintHex(uid, uidLength);
if (uidLength == 4)
{
// We probably have a Mifare Classic card ...
uint32_t cardid = uid[0];
cardid <<= 8;
cardid |= uid[1];
cardid <<= 8;
cardid |= uid[2];
cardid <<= 8;
cardid |= uid[3];
Serial.print("Seems to be a Mifare Classic card #");
Serial.println(cardid);
}
Serial.println("");
} else {
Serial.println("nfc.readPassiveTarget Failed\n");
}
}