I bought this nfc reader some days ago: http://es.aliexpress.com/item/Mini-PN532-NFC-RFID-Reader-Writer-Module-For-Arduino-Android-Phone/2038722238.html?recommendVersion=1 and yesterday I tried to use it. But I've been experiencing a lot of problemes with it.
first of all: all the pn532 drivers are the same? Which library should use?
I tried with an adafruit library and It's not working for me, It doesn't print nothing in the serial display :S
Help,
thank youu
So how have you wired it up, schematic please.
And what code are you running, code please (in code tags use the </> icon )
The list of NXP NFC IC chip:
- NXP PN531 Obsolete
- NXP PN532 Most of NFC shield, if not all.
- NXP PN533 (SCM SCL3711)
- NXP PR533
- NXP PN544
- NXP PN65N
- NXP PN65V10 Apple Iphone 6
- NXP PN7120
http://forum.arduino.cc/index.php?topic=296382.msg2109685#msg2109685
NXP PN532 has 3 interfaces I2C, SPI, UART. The library and interface have to matched.
NXP PN532 with Arduino does not support complete NFC types.
sonnyyu:
The list of NXP NFC IC chip:
- NXP PN531 Obsolete
- NXP PN532 Most of NFC shield, if not all.
- NXP PN533 (SCM SCL3711)
- NXP PR533
- NXP PN544
- NXP PN65N
- NXP PN65V10 Apple Iphone 6
- NXP PN7120
NFC & YUN - #7 by sonnyyu - Arduino Yún - Arduino Forum
NXP PN532 has 3 interfaces I2C, SPI, UART. The library and interface have to matched.
NXP PN532 with Arduino does not support complete NFC types.
Depending on the interface the use of the wires change no? But can I use all of the intarfaces or this RFID supports only one of them?
Grumpy_Mike:
So how have you wired it up, schematic please.And what code are you running, code please (in code tags use the </> icon )
I have installed this adafruit library: Arduino Library | Adafruit PN532 RFID/NFC Breakout and Shield | Adafruit Learning System
I wired as the example code says and I am running mifare test, everything seems to be ok. :S
You did not address my questions.
So how have you wired it up.
and
schematic please.
yeehaaw:
Depending on the interface the use of the wires change no? But can I use all of the intarfaces or this RFID supports only one of them?
You could wire PN532 with Arduino via one of them, and have to changed library match with it.
yeehaaw:
I have installed this adafruit library: Arduino Library | Adafruit PN532 RFID/NFC Breakout and Shield | Adafruit Learning System
I wired as the example code says and I am running mifare test, everything seems to be ok. :S
In the past there were two separate Arduino libraries for using the Adafruit NFC boards. One library supported the breakout over a SPI connection, and the other library supported the breakout or shield over an I2C connection. However both of these libraries have been merged into a single Arduino library, Adafruit-PN532.
The Adafruit PN532 library has the ability to read MiFare cards, including the hard-coded ID numbers, as well as authenticate and read/write EEPROM chunks. It can work with both the breakout and shield using either a SPI or I2C connection.
SPI or I2C connection , no UART support.
If you wired UART, you need different library.
The Adafruit PN532 library has the ability to read MiFare cards, including the hard-coded ID numbers, as well as authenticate and read/write EEPROM chunks. It can work with both the breakout and shield using either a SPI or I2C connection.
Mifare Classic is not an NFC Forum compatible card. Mifare Classic 1K/4K is not NFC card!
- NFC Forum Type 1 Broadcom Topaz
- NFC Forum Type 2 Mifare Ultralight, Mifare Ultralight C
- NFC Forum Type 3 Sony FeliCa
- NFC Forum Type 4 Mifare Desfire (ev1/ev2), NXP SmartMX with JCOP
Mifare Classic is not an NFC Forum compatible card. It requires NXP's Crypto 1 support that is
only available in NXP reader ICs and crypto keys that are not published in NFC Forum specifications.
http://forum.arduino.cc/index.php?topic=296382.msg2068600#msg2068600
Grumpy_Mike:
You did not address my questions.So how have you wired it up.
and
schematic please.
SCK-2
MOSI-3
SS-4
MISO-5
GROUND-GROUND
5V-5V
#include <Adafruit_PN532.h>
#define SCK (2)
#define MOSI (3)
#define SS (4)
#define MISO (5)
Adafruit_PN532 nfc(SCK, MISO, MOSI, SS);
void setup(void) {
Serial.begin(9600);
Serial.println("Hello!");
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>>24) & 0xFF, HEX);
Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
// configure board to read RFID tags
nfc.SAMConfig();
Serial.println("Waiting for an ISO14443A Card ...");
}
void loop(void) {
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);
Serial.println("");
if (uidLength == 4)
{
// We probably have a Mifare Classic card ...
Serial.println("Seems to be a Mifare Classic card (4 byte UID)");
// Now we need to try to authenticate it for read/write access
// Try with the factory default KeyA: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
Serial.println("Trying to authenticate block 4 with default KEYA value");
uint8_t keya[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
// Start with block 4 (the first block of sector 1) since sector 0
// contains the manufacturer data and it's probably better just
// to leave it alone unless you know what you're doing
success = nfc.mifareclassic_AuthenticateBlock(uid, uidLength, 4, 0, keya);
if (success)
{
Serial.println("Sector 1 (Blocks 4..7) has been authenticated");
uint8_t data[16];
// If you want to write something to block 4 to test with, uncomment
// the following line and this text should be read back in a minute
// data = { 'a', 'd', 'a', 'f', 'r', 'u', 'i', 't', '.', 'c', 'o', 'm', 0, 0, 0, 0};
// success = nfc.mifareclassic_WriteDataBlock (4, data);
// Try to read the contents of block 4
success = nfc.mifareclassic_ReadDataBlock(4, data);
if (success)
{
// Data seems to have been read ... spit it out
Serial.println("Reading Block 4:");
nfc.PrintHexChar(data, 16);
Serial.println("");
// Wait a bit before reading the card again
delay(1000);
}
else
{
Serial.println("Ooops ... unable to read the requested block. Try another key?");
}
}
else
{
Serial.println("Ooops ... authentication failed: Try another key?");
}
}
if (uidLength == 7)
{
// We probably have a Mifare Ultralight card ...
Serial.println("Seems to be a Mifare Ultralight tag (7 byte UID)");
// Try to read the first general-purpose user page (#4)
Serial.println("Reading page 4");
uint8_t data[32];
success = nfc.mifareultralight_ReadPage (4, data);
if (success)
{
// Data seems to have been read ... spit it out
nfc.PrintHexChar(data, 4);
Serial.println("");
// Wait a bit before reading the card again
delay(1000);
}
else
{
Serial.println("Ooops ... unable to read the requested page!?");
}
}
}
}
Should I change the programmer to arduinoISP?
up
Waiting for a schematic.
Grumpy_Mike:
Waiting for a schematic.
Here you have it: Screenshot - b6adeb35208bee7f1a9d73ba3ba4c46e - Gyazo
Very funny.
now
There isn't PN532 board in Fritzing so I used this board. I thin that is clear.
image
Hello guys, i know this is a very old post.
i connected my PN532 as specified in the PN532 manual, everything works perfect.reads any ISO14443a Cards tags, and NFC Phones.
I connected my PN532 using SPI and didn't have any issues at all, only issues i had was with the library but that was about location placement, other then that no issues
My only issue i have is that I want it to read ISO14443b cards. according to the manual it can, but there is no library and there is no support for ISO14443b cards. i did find this link with useful information, but once again another dead end. Can't read ISO14443B TAG · Issue #397 · nfc-tools/libnfc · GitHub
Hopefully someone here can point me to the right direction...or if anyone need help on connection or configuring please message me.
thnx