Giter VIP home page Giter VIP logo

adafruit-pn532's Introduction

Adafruit-PN532 Build Status

This is a library for the Adafruit PN532 NFC/RFID breakout boards This library works with the Adafruit NFC breakout

Check out the links above for our tutorials and wiring diagrams These chips use I2C or SPI to communicate.

Dependencies

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation and doxygen

Documentation is produced by doxygen. Contributions should include documentation for any new code added.

Some examples of how to use doxygen can be found in these guide pages:

https://learn.adafruit.com/the-well-automated-arduino-library/doxygen

https://learn.adafruit.com/the-well-automated-arduino-library/doxygen-tips

Formatting and clang-format

This library uses clang-format to standardize the formatting of .cpp and .h files. Contributions should be formatted using clang-format:

The -i flag will make the changes to the file.

clang-format -i *.cpp *.h

If you prefer to make the changes yourself, running clang-format without the -i flag will print out a formatted version of the file. You can save this to a file and diff it against the original to see the changes.

Note that the formatting output by clang-format is what the automated formatting checker will expect. Any diffs from this formatting will result in a failed build until they are addressed. Using the -i flag is highly recommended.

clang-format resources

Written by Limor Fried/Ladyada & Kevin Townsend for Adafruit Industries. BSD license, check license.txt for more information All text above must be included in any redistribution

To install, use the Arduino Library Manager and search for "Adafruit PN532" and install the library. Adafruit BusIO library is also required

adafruit-pn532's People

Contributors

andydoro avatar caternuson avatar driverblock avatar dsanders11 avatar evaherrada avatar ewpa avatar hoffmannjan avatar ivoh95 avatar ladyada avatar microbuilder avatar paintyourdragon avatar salmg avatar scott-42 avatar siddacious avatar tdicola avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit-pn532's Issues

Change default protocol to I2C in examples

It's a bit strange that the default behaviour of the board is to use I2C (without soldering pads SEL0 and SEL1), but all the examples uses SPI (if not modifying the sketch). This means that users will not get the board working unless doing one of the two modifications.

Adafruit PN532 not working with Arduino uno wifi ver.2

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

Receiving Response instead of ACK

Using ESP32 dev kit, Platformio, library version 1.2.2

During initialization I receive the following sequence instead of an ACK

0x0 0x3F 0xDF 0xFF 0xE9 0xAF

The code executed so far is

Adafruit_PN532 nfc(PN532_SS);
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();

With build_flags = -DPN532DEBUG the serial monitor shows

Sending : 0x0, 0x0, 0xFF, 0x2, 0xFE, 0xD4, 0x2, 0x2A, 0x0, 
Sending : 0x0, 0x0, 0xFF, 0x2, 0xFE, 0xD4, 0x2, 0x2A, 0x0, 
No ACK:  0x0 0x3F 0xDF 0xFF 0xE9 0xAF
No ACK frame received!

I checked the PN532 user manual.
Normally, whatever state it is in, it should abort ANY prior command when receiving a new command (page 38).
This is clearly the case (i also checked with a logic analyzer) when retrieving the firmware version.

After this, the code correctly waits for the IC to be ready

// Wait for chip to say its ready!
  if (!waitready(timeout)) {
    return false;
  }

where it reads the status register until it is RDY.

After this, bool Adafruit_PN532::readack() is called.
In the manual on page 45 the procedure is explained.

The code follow this exactly

if (spi_dev) {
    uint8_t cmd = PN532_SPI_DATAREAD;
    spi_dev->write_then_read(&cmd, 1, ackbuff, 6);
  }

According to the manual, even in case of a syntax error, it will respond with an ACK.
This means, the received data is the response to a prior command. Therefore an ACK was missed.
It is unclear how and where it happens.

Use a mobile phone instead of a card

Hi, I am using the pn532 module
My wiring and connection to the module is through the software serial
When I hold the mobile phone in front of this module, it displays a different UID each time.
I want to use a mobile phone instead of a card and each phone has a unique ID so I can identify who this mobile phone is for.

My board : wemos d1 mini

please guide me

Warnings on compile

When Running readMifare I get these warnings:

/Users/watchmyfeet/Documents/Arduino/libraries/Adafruit-PN532-master/Adafruit_PN532.cpp: In member function 'uint8_t Adafruit_PN532::mifareclassic_WriteNDEFURI(uint8_t, uint8_t, const char_)':
/Users/watchmyfeet/Documents/Arduino/libraries/Adafruit-PN532-master/Adafruit_PN532.cpp:1048:53: warning: narrowing conversion of '(((int)len) + 5)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len+5, 0xD1, 0x01, len+1, 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
^
/Users/watchmyfeet/Documents/Arduino/libraries/Adafruit-PN532-master/Adafruit_PN532.cpp:1048:72: warning: narrowing conversion of '(((int)len) + 1)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len+5, 0xD1, 0x01, len+1, 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
^
/Users/watchmyfeet/Documents/Arduino/libraries/Adafruit-PN532-master/Adafruit_PN532.cpp: In member function 'uint8_t Adafruit_PN532::ntag2xx_WriteNDEFURI(uint8_t, char_, uint8_t)':
/Users/watchmyfeet/Documents/Arduino/libraries/Adafruit-PN532-master/Adafruit_PN532.cpp:1416:8: warning: narrowing conversion of '(((int)len) + 5)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
len+5, /* Payload Length (not including 0xFE trailer) /
^
/Users/watchmyfeet/Documents/Arduino/libraries/Adafruit-PN532-master/Adafruit_PN532.cpp:1419:8: warning: narrowing conversion of '(((int)len) + 1)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
len+1, /
Payload len */
^

and also these:

Sketch uses 8,960 bytes (27%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,067 bytes (52%) of dynamic memory, leaving 981 bytes for local variables. Maximum is 2,048 bytes.
avrdude: can't open input file /var/folders/08/1q3506q14bv8ycjvjc9zzrk00000gn/T/build279b921e1715ac438203aef4b85f66b2.tmp/readMifare.ino.hex: No such file or directory
avrdude: read from file '/var/folders/08/1q3506q14bv8ycjvjc9zzrk00000gn/T/build279b921e1715ac438203aef4b85f66b2.tmp/readMifare.ino.hex' failed

SPI Multiple Slaves CS Issue

Multiple SPI slaves is not working correctly, the SS pin is not set high upon defining of each NFC instance and multiple slaves get selected since the pin is low by default.

To fix this a digitalWrite(_ss, HIGH); needs to be added after lines 182 and lines 137 in the .ccp file

The bug has been tested and confirmed on an arduino mega and arduino mega. And the fix has been tested to work with 6 nfc readers.

Only receiving 31 bytes from ISO14443A card

I have activated debug output and I see that after 31 byte of data always 0xFF coming from i2c_recv() in line 1752. Has anyone tried to receive more than 31 byte from a java smart card? I am happy about any hint.
Output Example:
Reading: 0x0 0x0 0xFF 0x46 0xBA 0xD5 0x41 0x0 0x4 0xAF 0x7F 0x4F 0x60 0x31 0x6D 0xB9 0x76 0x8C 0x88 0x9D 0x7B 0x32 0xCC 0x25 0x63 0x2D 0xE9 0xF6 0x75 0x67 0x63 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF

PN532 + Huzzah

Hi,

You wrote that the PN532 could be used in SPI mode with the Huzzah, however, when I try to assign the (CLK, MISO, MOSI, SS) to some arbitrary GPIO pins, I get an error message "TIMEOUT, Didn't fin d PN532 Board" (sometimes, followed by a system crash:

stack>>>
3ffefc90: 3fffdc20 00000000 3ffefd0c 40201cb4
3ffefca0: 3fffdc20 00000000 3ffeec8c 40202fba
3ffefcb0: 00000000 00000000 3ffeeca0 40100114
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld

Any tips how I can get these two to work in harmony ?

Does not work with samd M4 boards

/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp: In member function 'void Adafruit_PN532::begin()':
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp:71:28: error: 'SPI_CLOCK_DIV16' was not declared in this scope
#define PN532_SPI_CLOCKDIV SPI_CLOCK_DIV16
^
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp:190:27: note: in expansion of macro 'PN532_SPI_CLOCKDIV'
SPI.setClockDivider(PN532_SPI_CLOCKDIV);
^
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp: In member function 'uint8_t Adafruit_PN532::mifareclassic_WriteNDEFURI(uint8_t, uint8_t, const char*)':
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp:1045:53: warning: narrowing conversion of '(((int)len) + 5)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len+5, 0xD1, 0x01, len+1, 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
^
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp:1045:72: warning: narrowing conversion of '(((int)len) + 1)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len+5, 0xD1, 0x01, len+1, 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
^
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp: In member function 'uint8_t Adafruit_PN532::ntag2xx_WriteNDEFURI(uint8_t, char*, uint8_t)':
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp:1413:8: warning: narrowing conversion of '(((int)len) + 5)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
len+5, /* Payload Length (not including 0xFE trailer) /
^
/home/dean/Arduino/libraries/Adafruit_PN532/Adafruit_PN532.cpp:1416:8: warning: narrowing conversion of '(((int)len) + 1)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
len+1, /
Payload len */
^
Using library Wire at version 1.0 in folder: /home/dean/.arduino15/packages/adafruit/hardware/samd/1.2.0/libraries/Wire
Using library SPI at version 1.0 in folder: /home/dean/.arduino15/packages/adafruit/hardware/samd/1.2.0/libraries/SPI
Using library Adafruit_PN532 at version 1.0.0 in folder: /home/dean/Arduino/libraries/Adafruit_PN532
exit status 1
Error compiling for board Adafruit Grand Central M4 (SAMD51).

NDEF NTAG215 and 216 compatability

The nfc.ntag2xx_WriteNDEFURI(ndefprefix, url, dataLength) is written with dataLength defined as a uint8_t, which limits the data size to 256, even though NTAG215 and NTAG216 tags have much more memory than this.

A simple test of writing 450 x "a" will show it only writes 194 characters, which results from the 0x1C2 having being converted to 0xC2 by stuffing it in a uint8_t.

with STM32

Can i use this library woth stm32? how do this

ntag2xx_WriteNDEFURI sets up incorrect Lock Control TLV

Hello,

The Adafruit_PN532::ntag2xx_WriteNDEFURI method writes an NDEF URI in a NTAG2xx tag. To do so, it completely reformats the user data memory area. This is how that's achieved:

  // Setup the record header
  // See NFCForum-TS-Type-2-Tag_1.1.pdf for details
  uint8_t pageHeader[12] = {
      /* NDEF Lock Control TLV (must be first and always present) */
      0x01, /* Tag Field (0x01 = Lock Control TLV) */
      0x03, /* Payload Length (always 3) */
      0xA0, /* The position inside the tag of the lock bytes (upper 4 = page
               address, lower 4 = byte offset) */
      0x10, /* Size in bits of the lock area */
      0x44, /* Size in bytes of a page and the number of bytes each lock bit can
               lock (4 bit + 4 bits) */
      /* NDEF Message TLV - URI Record */
      [ ... etc ... ]
  };

While reformatting the memory area, the method writes a Lock Control TLV.

There are two issues with this:

  1. The TLV, as hardcoded in the method, seems (i.e. as per back-of-the-envelope computation) to be completely wrong for all NTAG2xx platforms, and as it is hardcoded, it can ever be correct correct for at most a specific model of the platform series
  2. In contrast to what is suggested in the comment, the TVL block does not always have to be present; the NFC Forum standard for T2T platforms states (RQ_T2T_MEM_021): "The Lock Control TLV can be present inside the Type 2 Tag Platform." And in fact, in the case of NTAG2xx platforms, it is completely useless, as the user data area is contiguous and limited by the Capability Container.

Since it is both wrong and useless, I suggest that it should not be written. If you agree, I would be happy to submit a pull request.

SPI.beginTransaction is called twice, locks up on ESP32

The begin function blocks itself, when SPI_HAS_TRANSACTION is defined and Hardware SPI is used.

In begin SPI.beginTransaction is called first at

SPI.beginTransaction(PN532_SPI_SETTING);

then sendCommandCheckAck is called which itself calles writecommand which tries to start another transaction with SPI.beginTransaction.
if (_hardwareSPI) SPI.beginTransaction(PN532_SPI_SETTING);

On an ESP32 with the arduino-esp32 framework the SPI.beginTransaction calls the spiTransaction function which uses an SPI_MUTEX_LOCK:

https://github.com/espressif/arduino-esp32/blob/1.0.0/cores/esp32/esp32-hal-spi.c#L702-L707

This combination of calling SPI.beginTransaction twice (in begin and writecommand) causes a hang on the second invocation, because the SPI_MUTEX_LOCK is never unlocked.


  • Arduino board: ESP32 w/ arduino-esp32 (tag: 1.0.0)

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

#define SPI_HAS_TRANSACTION
#include <SPI.h>
#define PN532DEBUG
#include <Adafruit_PN532.h>

Adafruit_PN532 nfc(18);

void setup() {
  nfc.begin(); // see debug output, hangs at "Sending:" (no bytes after this message)
}
void loop() {
}

UID's not read fully for MiFare Ultralights

While MiFare Classic cards have 4-byte UID's that fit into uint32_t types, MiFare Ultralights have 7-byte UID's.
The UID reading function should accomodate these larger UID's somehow; maybe just returned as a char string?

Cant write text/plain ndef messages with the adafruit 532

i am trying to write into ntag213 (ultralight c) some text and read it on my android.
however i am not able to do it.
i dont see an example that writes text/plain ndef messages can you please let me know how to write text on that tag.
Thank you :)

PN532 Library Does not Work

I used these items:

  • Linklt 7697

  • Arduino IDE 1.8.2

  • NFC sensor

I cannot compile my project using NFC sensor.
How can I do?

I learn from YouTube how this sensor to work.
https://www.youtube.com/watch?v=PHUNECa4oso

My first code

#include <Wire.h>
#include <SPI.h>
#include <PN532.h>

void setup() {
  // put your setup code here, to run once:

}

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

}

Error message!

C:\Users\LingChingYan\Documents\Arduino\libraries\PN532\PN532.cpp: In member function 'void PN532::begin()':

C:\Users\LingChingYan\Documents\Arduino\libraries\PN532\PN532.cpp:43:13: error: 'class SPIClass' has no member named 'setDataMode'

   pn532_SPI.setDataMode(SPI_MODE0);

             ^

C:\Users\LingChingYan\Documents\Arduino\libraries\PN532\PN532.cpp:44:13: error: 'class SPIClass' has no member named 'setBitOrder'

   pn532_SPI.setBitOrder(LSBFIRST);

             ^

C:\Users\LingChingYan\Documents\Arduino\libraries\PN532\PN532.cpp:47:13: error: 'class SPIClass' has no member named 'setClockDivider'

   pn532_SPI.setClockDivider(SPI_CLOCK_DIV16);

             ^

C:\Users\LingChingYan\Documents\Arduino\libraries\PN532\PN532.cpp:47:29: error: 'SPI_CLOCK_DIV16' was not declared in this scope

   pn532_SPI.setClockDivider(SPI_CLOCK_DIV16);

                             ^
exit status 1

My second code

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>

void setup() {
  // put your setup code here, to run once:

}

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

}

Error message

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp: In function 'void i2c_send(uint8_t)':

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:55:15: error: 'Wire1' was not declared in this scope

  #define WIRE Wire1

               ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:90:5: note: in expansion of macro 'WIRE'

     WIRE.write((uint8_t)x);

     ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp: In function 'uint8_t i2c_recv()':

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:55:15: error: 'Wire1' was not declared in this scope

  #define WIRE Wire1

               ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:104:12: note: in expansion of macro 'WIRE'

     return WIRE.read();

            ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp: In member function 'void Adafruit_PN532::begin()':

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:188:11: error: 'class SPIClass' has no member named 'setDataMode'

       SPI.setDataMode(SPI_MODE0);

           ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:189:11: error: 'class SPIClass' has no member named 'setBitOrder'

       SPI.setBitOrder(LSBFIRST);

           ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:190:11: error: 'class SPIClass' has no member named 'setClockDivider'

       SPI.setClockDivider(PN532_SPI_CLOCKDIV);

           ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:71:28: error: 'SPI_CLOCK_DIV16' was not declared in this scope

 #define PN532_SPI_CLOCKDIV SPI_CLOCK_DIV16

                            ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:190:27: note: in expansion of macro 'PN532_SPI_CLOCKDIV'

       SPI.setClockDivider(PN532_SPI_CLOCKDIV);

                           ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:55:15: error: 'Wire1' was not declared in this scope

  #define WIRE Wire1

               ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:213:5: note: in expansion of macro 'WIRE'

     WIRE.begin();

     ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp: In member function 'void Adafruit_PN532::readdata(uint8_t*, uint8_t)':

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:55:15: error: 'Wire1' was not declared in this scope

  #define WIRE Wire1

               ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:1596:5: note: in expansion of macro 'WIRE'

     WIRE.requestFrom((uint8_t)PN532_I2C_ADDRESS, (uint8_t)(n+2));

     ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp: In member function 'void Adafruit_PN532::writecommand(uint8_t*, uint8_t)':

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:55:15: error: 'Wire1' was not declared in this scope

  #define WIRE Wire1

               ^

C:\Users\LingChingYan\Documents\Arduino\libraries\Adafruit_PN532\Adafruit_PN532.cpp:1697:5: note: in expansion of macro 'WIRE'

     WIRE.beginTransmission(PN532_I2C_ADDRESS);

     ^

exit status 1

I try to add items to my code,but It can not continue to run.

#include <stdint.h>
#include <stdbool.h>

I try to comment out that part of the file(lines 52 to 57 of Adafruit_PN532.cpp),but It can not continue to run.

#if defined(__AVR__) || defined(__i386__) || defined(ARDUINO_ARCH_SAMD) || defined(ESP8266) || defined(ARDUINO_ARCH_STM32)
 #define WIRE Wire
#else // Arduino Due
 #define WIRE Wire1
#endif

Feather M0 spi

  • Arduino board: Adafruit Feather M0 basic

  • Arduino IDE version : 1.8.5

I use the example "readMifareClassic" in this library.
I checked the compatibility in the main page, i attached the device with SPI, but the compiler give me this error:
/tmp/arduino_modified_sketch_622904/readMifareClassic.pde: In function 'void setup()': readMifareClassic:67: error: 'SerialUSB' was not declared in this scope #define Serial SerialUSB ^ /tmp/arduino_modified_sketch_622904/readMifareClassic.pde:72:13: note: in expansion of macro 'Serial' while (!Serial); // for Leonardo/Micro/Zero ^ readMifareClassic:67: error: 'SerialUSB' was not declared in this scope #define Serial SerialUSB ^ /tmp/arduino_modified_sketch_622904/readMifareClassic.pde:74:3: note: in expansion of macro 'Serial' Serial.begin(115200); ^ /tmp/arduino_modified_sketch_622904/readMifareClassic.pde: In function 'void loop()': readMifareClassic:67: error: 'SerialUSB' was not declared in this scope #define Serial SerialUSB ^ /tmp/arduino_modified_sketch_622904/readMifareClassic.pde:108:5: note: in expansion of macro 'Serial' Serial.println("Found an ISO14443A card"); ^ exit status 1 'SerialUSB' was not declared in this scope

Each second passiv read of Target ID does not find a card.

Hi, i'm using the readPassiveTargetID function.
Cards with 4byte-IDs are detected permanently. But each 2nd read of a card with 7 bytes does not work.

Any advice?

Thg.

Output @ 4byte Cards:
NOCARD
NOCARD
CARDFOUND // placed card
CARDFOUND
CARDFOUND
CARDFOUND // removed card
NOCARD
NOCARD

Output @ 7byte Cards:
NOCARD
NOCARD
CARDFOUND // placed card
NOCARD
CARDFOUND
NOCARD
CARDFOUND
NOCARD
CARDFOUND // removed card
NOCARD
NOCARD

Library no longer compiles on platformio for ESP32

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

Esp32 Dev Module w/SSD1306 Screen

  • Arduino IDE version (found in Arduino -> About Arduino menu):

PlarformIO for VS Code, Home v3.0.1 Core v4.1.0

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

I have compiled this sketch successfully many times up to a couple month ago when I last used it. Then I tried recompiling and got these errors (and many warnings too, but the warnings have always been there - the errors forbidding me to compile is something new):

In file included from .pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:60:0:
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h: In constructor 'Adafruit_PN532::Adafruit_PN532(uint8_t, uint8_t, uint8_t, uint8_t)':
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:29: error: 'Adafruit_PN532::_miso' will be initialized after [-Werror=reorder]   
   uint8_t _ss, _clk, _mosi, _miso;
                             ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:22: error:   'uint8_t Adafruit_PN532::_mosi' [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                      ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:127:1: error:   when initialized here [-Werror=reorder]
 Adafruit_PN532::Adafruit_PN532(uint8_t clk, uint8_t miso, uint8_t mosi, uint8_t ss):
 ^
In file included from .pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:60:0:
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:22: error: 'Adafruit_PN532::_mosi' will be initialized after [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                      ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:11: error:   'uint8_t Adafruit_PN532::_ss' [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
           ^
Compiling C:\Users\Massi\AppData\Local\Temp\pio-build\CROVE_RFID_Test-7a3db15896\esp32dev\lib142\BLE\BLEBeacon.cpp.o
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:127:1: error:   when initialized here [-Werror=reorder]
 Adafruit_PN532::Adafruit_PN532(uint8_t clk, uint8_t miso, uint8_t mosi, uint8_t ss):
 ^
In file included from .pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:60:0:
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h: In constructor 'Adafruit_PN532::Adafruit_PN532(uint8_t, uint8_t)':
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:29: error: 'Adafruit_PN532::_miso' will be initialized after [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                             ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:22: error:   'uint8_t Adafruit_PN532::_mosi' [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                      ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:152:1: error:   when initialized here [-Werror=reorder]
 Adafruit_PN532::Adafruit_PN532(uint8_t irq, uint8_t reset):
 ^
In file included from .pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:60:0:
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:22: error: 'Adafruit_PN532::_mosi' will be initialized after [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                      ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:11: error:   'uint8_t Adafruit_PN532::_ss' [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
           ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:152:1: error:   when initialized here [-Werror=reorder]
 Adafruit_PN532::Adafruit_PN532(uint8_t irq, uint8_t reset):
 ^
In file included from .pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:60:0:
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h: In constructor 'Adafruit_PN532::Adafruit_PN532(uint8_t)':
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:29: error: 'Adafruit_PN532::_miso' will be initialized after [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                             ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:22: error:   'uint8_t Adafruit_PN532::_mosi' [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                      ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:173:1: error:   when initialized here [-Werror=reorder]
 Adafruit_PN532::Adafruit_PN532(uint8_t ss):
 ^
In file included from .pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:60:0:
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:22: error: 'Adafruit_PN532::_mosi' will be initialized after [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
                      ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.h:202:11: error:   'uint8_t Adafruit_PN532::_ss' [-Werror=reorder]
   uint8_t _ss, _clk, _mosi, _miso;
           ^
.pio\libdeps\esp32dev\Adafruit PN532_ID29\Adafruit_PN532.cpp:173:1: error:   when initialized here [-Werror=reorder]

The sketch I am running is your readntag203.pde to read NTAG203 / NTAG213 cards, adapted to display also the tag UID on the display. Here it is:


/**************************************************************************/
/*! 
    @file     readntag203.pde
    @author   KTOWN (Adafruit Industries)
    @license  BSD (see license.txt)

    This example will wait for any NTAG203 or NTAG213 card or tag,
    and will attempt to read from it.

    This is an example sketch for the Adafruit PN532 NFC/RFID breakout boards
    This library works with the Adafruit NFC breakout 
      ----> https://www.adafruit.com/products/364
 
    Check out the links above for our tutorials and wiring diagrams 
    These chips use SPI or I2C to communicate.

    Adafruit invests time and resources providing this open source code, 
    please support Adafruit and open-source hardware by purchasing 
    products from Adafruit!
*/
/**************************************************************************/
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>
#include <SSD1306Wire.h>

// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SS   5
#define PN532_SCK  18
#define PN532_MOSI 23
#define PN532_MISO 19 // conect MISO w/MISO, MOSI w/MOSI

// If using the breakout or shield with I2C, define just the pins connected
// to the IRQ and reset lines.  Use the values below (2, 3) for the shield!
#define PN532_IRQ   (22)
#define PN532_RESET (21)  // Not connected by default on the NFC Shield
#define OLEDRESETPIN 16
#define CODE "CROVE_ESP32_RFIDTest"

// Uncomment just _one_ line below depending on how your breakout or shield
// is connected to the Arduino:

// Use this line for a breakout with a software SPI connection (recommended):
Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);

// Use this line for a breakout with a hardware SPI connection.  Note that
// the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's
// hardware SPI SCK, MOSI, and MISO pins.  On an Arduino Uno these are
// SCK = 13, MOSI = 11, MISO = 12.  The SS line can be any digital IO pin.
//Adafruit_PN532 nfc(PN532_SS);

// Or use this line for a breakout or shield with an I2C connection:
//Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
// also change #define in Adafruit_PN532.cpp library file
   #define Serial SerialUSB
#endif

SSD1306Wire display(0x3c, 4, 15);

void initDisplay() {
  pinMode(OLEDRESETPIN, OUTPUT);   // OLED reset pin
  digitalWrite(OLEDRESETPIN, LOW); // set GPIO16 low to reset OLED
  delay(50);
  digitalWrite(OLEDRESETPIN, HIGH); // while OLED is running, must set GPIO16 in high
  delay(50);
  display.init();
  display.flipScreenVertically();

}
void startupMessage()
{
  #if defined(CODE)
  Serial.println(CODE);
  display.clear();
  display.setTextAlignment(TEXT_ALIGN_CENTER);
  display.setFont(ArialMT_Plain_10);
  display.drawStringMaxWidth(64, 24, 128, CODE);
  display.display();
  delay(2000);
  #endif
}

void setup(void) {
  #ifndef ESP8266
    while (!Serial); // for Leonardo/Micro/Zero
  #endif
  Serial.begin(115200);
  Serial.println("Hello!");
  nfc.begin();
  uint32_t versiondata = nfc.getFirmwareVersion();
  Serial.println("Finding Board...");
while(! versiondata) {
Serial.println("Didn't find PN53x board");
    delay(1000);
    versiondata = nfc.getFirmwareVersion();
  }
  // 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 ...");
  initDisplay();
  startupMessage();
}

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 NTAG203 card.  When one is found 'uid' will be populated with
  // the UID, and uidLength will indicate the size of the UUID (normally 7)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
  
  if (success) {
    // Display some basic information about the card
    display.clear();
    display.setFont(ArialMT_Plain_16);
    display.setTextAlignment(TEXT_ALIGN_CENTER);
    display.drawStringMaxWidth(64, 0, 128, "ISO14443A card");
    display.display();

    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 == 7)
    {
      uint8_t data[32];
      
      // We probably have an NTAG2xx card (though it could be Ultralight as well)
    display.clear();
    display.setFont(ArialMT_Plain_16);
    display.setTextAlignment(TEXT_ALIGN_CENTER);
    display.drawStringMaxWidth(64, 0, 128, "NTAG2xx tag (7 byte UID)");
    display.display();
      Serial.println("Seems to be an NTAG2xx tag (7 byte UID)");	  
      
      // NTAG2x3 cards have 39*4 bytes of user pages (156 user bytes),
      // starting at page 4 ... larger cards just add pages to the end of
      // this range:
      
      // See: http://www.nxp.com/documents/short_data_sheet/NTAG203_SDS.pdf

      // TAG Type       PAGES   USER START    USER STOP
      // --------       -----   ----------    ---------
      // NTAG 203       42      4             39
      // NTAG 213       45      4             39
      // NTAG 215       135     4             129
      // NTAG 216       231     4             225      

      for (uint8_t i = 0; i < 42; i++) 
      {
        success = nfc.ntag2xx_ReadPage(i, data);
        
        // Display the current page number
        Serial.print("PAGE ");
        if (i < 10)
        {
          Serial.print("0");
          Serial.print(i);
        }
        else
        {
          Serial.print(i);
        }
        Serial.print(": ");

        // Display the results, depending on 'success'
        if (success) 
        {
          // Dump the page data
          nfc.PrintHexChar(data, 4);
        }
        else
        {
          Serial.println("Unable to read the requested page!");
        }
      }
    }
    else
    {
      Serial.println("This doesn't seem to be an NTAG203 tag (UUID length != 7 bytes)!");
    }
    
    // Wait a bit before trying again
    Serial.println("\n\nSend a character to scan another tag!");
/*    Serial.flush();
    while (!Serial.available());
    while (Serial.available()) {
    Serial.read();
    }*/
    Serial.flush();    
  }
}

this, FWIW, is my platformio.ini file:


; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
build_dir = ${sysenv.TEMP}/pio-build/$PROJECT_HASH

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
  Wire
  Adafruit PN532
  ESP8266_SSD1306
  SPI
monitor_speed = 115200
board_build.f_cpu = 80000000L

I want to stress that the sketch compiled fine up till now (it is running on a board, I just wanted to change a line but it will no longer successfully compile). It seems a problem of compiler options here but am not sure...

Any help or pointer in the right direction very much appreciated as am currently stuck.

PN532 and ESP8266HTTPClient library incompatibility

Hi there,

After a two week of struggling and without a solution I figured out that the PN532 library is interfering with ESP8266HTTPClient library while calling GET() function.

If I comment the RFID reading part from the Sketch loop, everything is working as it should.

I'm using WeMos D1 mini with PN532 over SPI, Arduino IDE v1.8.2, ESP8266 Core 2.3.0 and v2.7.1.

View full illustrated report and description here.

Any help would be appreciated,

Kind regards,
Viktor

Apple Pay

hello,

I noticed that when passing my phone near the reader , Apple Pay automatically activate , even if there's no payment to do.

It is possible to configure the reader to don't make Apple Pay activate?

Extract EMV Application ID

Hello, I got my Adafruit-PN532 board in order to read the Application ID (AID) for payment cards (EMVs). More specifically for VISA cards, the only information I need is the AID and nothing else.
After playing with the board, VISA wireless is "Mifare Ultralight". I've tried read page by page to get the application Id, however I can not find it. Any ideas?
Thanks a lot in advance.

M5 paper UART

hello
i have a M5paper ( ESP32 ), i have a port C grove, GPIO 18 / GPIO 19,
but i have the error : Didn’t find PN53x board

`#include <NfcAdapter.h>
#include <PN532/PN532/PN532.h>
#include <M5EPD.h>
#include "driver/gpio.h"
#include "driver/adc.h"

#include <PN532/PN532_HSU/PN532_HSU.h>
//HardwareSerial Serial1(1);

PN532_HSU pn532hsu(Serial1);
NfcAdapter nfc(pn532hsu);
void setup(void) {
M5.begin();
Serial1.println("NDEF begin");
delay(5000);
Serial1.begin(9600, SERIAL_8N1, 18, 19);

//Wire.begin(18, 19);

Serial1.println("NDEF Reader");
nfc.begin();
}

void loop(void) {
SERIAL.println("\nScan a NFC tag\n");
if (nfc.tagPresent()) {
NfcTag tag = nfc.read();
tag.print();
}
//delay(5000);
M5.update();
delay(100);
}`

and second test

`#include <NfcAdapter.h>
#include <PN532/PN532/PN532.h>
#include <M5EPD.h>

#include <PN532/PN532_SWHSU/PN532_SWHSU.h>
#include "SoftwareSerial.h"
//HardwareSerial Serial1(1);
SoftwareSerial SWSerial(19, 18);
PN532_SWHSU pn532swhsu(SWSerial);
NfcAdapter nfc(pn532swhsu);

void setup(void) {
M5.begin();
Serial1.println("NDEF begin");
//delay(5000);
Serial1.begin(9600);
Serial1.println("NDEF Reader");
nfc.begin();
}

void loop(void) {
SERIAL.println("\nScan a NFC tag\n");
if (nfc.tagPresent()) {
NfcTag tag = nfc.read();
tag.print();
}
//delay(5000);
M5.update();
delay(100);
}`

Weird delays in the source code.

Hi,
The library has a bunch of "weird' delays in places where you don't expect them. I've ported the library for my own use, and thought I'd optimize the delays a bit. (thinking I would eliminate most of them... boy was I wrong).

i've given each of the delays in my code an identifier and use that identifier to index the "delays" array. If there is a nonzero number there, I wait for that number of tenth-of-a-milisecond-s.

While debugging I did add a few extra delays that were not there, so it'll be a bit of work for you to find the precise relationship between my delay identifiers and your code. But "isready_T1" and :"ISREADY_T2" are obviously both from the "isready" function. As both numbers ended up zero after my optimization of the delays, any delay in isready can be removed. Readdata t1 are the after-CS-delay, the before-get-the-data- and the after-get-the-data delays. Last one is zero as expected. etc.

/*
enum delays_id { ISREADY_T1, ISREADY_T2, READDATA_T1, READDATA_T2, READDATA_T3, 
		 WAITREADY, WRITECMD_T1, WRITECMD_T2, INIT_T1, INIT_T2, INIT_T3, 
		 // Keep this last 
		 LAST_DELAY_ID};
*/

int delays[MAXDELAYS] = {0, 0, 4, 10, 0, 
			 10, 10, 0, 2000, 0, 0};

Increasing the answer/command buffer size

Noticed that the buffer used for PN532 communication is limited by 64 bytes:

#define PN532_PACKBUFFSIZ 64

  • The C-APDU command length can be up to 261 bytes (CLA-INS-P1-P2-P3-255 data bytes-Le)
  • The R-APDU returned to the host controller can have a length of 258 bytes (256 data bytes-SW1-SW2)

By design, the library uses just one buffer for commands and answers with fixed size(PN532_PACKBUFFSIZ) but a very low one.

Using only 64 bytes from the PN532 buffer is almost four times less its limit. This limitation affects directly the ISO/14443A or raw communication projects.

Making some tests, I noticed that the actual library design could be implemented with a buffer size of 255 without changing anything else:

#define PN532_PACKBUFFSIZ 255

Timeout-Error when reading ISO1443 card with long APDU

  • Arduino board: Arduino Due

  • Arduino IDE version 1.8.12

  • NFC shield connected via I2C

  • Take a ISO14443 card (A, but patching the code to run with type B card will result in the same problem). For example: An NXP JCOP card (P5, P60), G&D Smartcafe JavaCard, or any other JavaCard. Or a German eID card.

  • If we send a short APDU (in my setup <= 23 byte long), the card reply is correctly read. Sending an APDU should result in an ISO7816 status code, e.g. sending a valid APDU should result in 0x9000, and sending an invalid APDU should result in an error code like 0x6700 or 0x6881. This works fine.

  • If we send a longer APDU (in my setup >= 24 byte), this results in a timeout.

More precisely, I was able to debug this down to:

calling
inDataExchange(apdu, apdu_len, response, &response_len);
-> if (!sendCommandCheckAck(pn532_packetbuffer,sendLength+2,1000)) will result in false returned.

Here within
-> sendCommandCheckAck the call will fail at
// Wait for chip to say its ready!
if (!waitready(timeout)) {

Increasing the timeout - even to large values - does not help, so I suspect some other fundamental (timing-related?) issue...

Tested this also with different versions of this library, i.e. "official 1.4" as well as the current branch, and the behaviour is the same.

Works on SAMD21

Hello,

The library works on SAMD21 (M0 Pro) using I2C, so the README should probably be corrected :)

  • R

ntag2xx_ReadPage only reads 4 bytes at a time

Adafruit_PN532.cpp specifically calls out in the code that it limits reads 4 bytes at a time:

/* Copy the 4 data bytes to the output buffer         */
/* Block content starts at byte 9 of a valid response */
/* Note that the command actually reads 16 byte or 4  */
/* pages at a time ... we simply discard the last 12  */
/* bytes                                              */

For the more modern tags (I'm using NTAG213) you can read 16 bytes at time. I don't understand the spec well enough to know if there is any way to test for this 4/16 split. However if I change the following line
memcpy (buffer, pn532_packetbuffer+8, 4);
to
memcpy (buffer, pn532_packetbuffer+8, 16);
It works great for my tag (and I'm running 4x faster)

One alternative would be to pass in a flag to ntag2xx_ReadPage so you could just specify reads of 4 or 16 bytes.

Arduino + PN532 with chip tsd9471 not work with emv card

hello. A I have 2 PN532 device first with chip tsd9471 and second with tsd4331. I try to read EMV bankcard, and have some trouble.
device with tsd4331 read fine, and device with tsd9471 always return fail on nfc.inListPassiveTarget(); with card but work fine with ApplePay.

Please help, how to make it universal? Thanks!

Handling responses with length >= 256

I'm sending ADPU commands using the inDataExchange method. The PN532 breakout board is communicating to an Arduino UNO via its SPI interface.
Everything worked fine so far but now I'm sending an INTERNAL AUTHENTICATE command which is expecting a response of length 256.
Unfortunately, the length variable is defined as a uint8_t and read off of a single preamble octet.

uint8_t length = pn532_packetbuffer[3];

Actually, no more than 252 bytes may be read into the responseBuffer.

length -= 3;

But the packetBuffer size is even smaller.

#define PN532_PACKBUFFSIZ 64

The INTERNAL AUTHENTICATE command doesn't seem to allow the reading of a response in chunks like the READ BINARY command does.

If I don't go wrong, the library is not supporting the extended frame response that's documented here:
https://cdn-shop.adafruit.com/datasheets/PN532C106_Application+Note_v1.2.pdf#page=10

NDEF Lock Control TLV not according to specification

Line 1405 of Adafruit_PN532.cpp sets the NDEF Lock Control TLV element. It writes the bytes 0x0103A01044. When looking at page 17 of https://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf then NTAG213 chips are factory-delivered with 0x0103A00C34. This is in sync with the samples found on page 22.

Is it possible that the Adafruit-written NDEF Lock Control TLV element is faulty?

Does it even matter? The NTAG215 and NTAG216 don't even contain a factory-installed NDEF Lock Control TLV element (again page 17 of the PDF). Is the field really necessary / mandatory? I have tried both with and without this element, and the iPhone can read both tags equally fine (with the iOS 11 CoreNFC API).

Arduino Library manager not updated

  • Arduino board: Adafruit Feather HUZZAH with ESP8266

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.7

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Install PN532 Library with library manager

I was able to download and install the library manually from the zip and it works, but it also shows up in Library Manager in Arduino as version 1.0.0 which will not compile. It installs in the manager as "Adafruit-PN532" however installing the downloaded zipped version reports "Adafruit-PN532-master"

Mime Type Record

I am trying to store and read mime type ndef record in mirafe classic, but can't find how to store it. All the examples are storing uri record instead.

I open up the library and still can't find any function to write/read different ndef record than the uri record.

SPI mode not working

  • Arduino board: Arduino DUE

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.5

I tried to use the example in SPI mode but it always said it didn't found the board. I tried before with adafruit nfc library with I2C mode and works well. But since I need use the SPI mode for p2p transfer, then I replace the adafruit with elechouse library, but still SPI mode not working.

Felica card support

What is your opinions on adding Felica style card support? I have added in support for both frequencies with reading the UID (8 bytes i believe) and am working on fixing some bugs. I am not planning at this time for adding in read/write support for any other part of this style, but will do so later after i get my project a little further along.

ESP32 SPI

Hi everybody.

  • Arduino board: M5Stack gray (ESP32)

  • Arduino IDE version PlatformIO Core 4.3.4 (Arduino IDE 1.8.13 not used).

  • List the steps to reproduce the problem below:

The ESP32 is marked as tested in the compatibility table. But if I use this example sketch with the M5Stack pinout, the board is not detected:

https://github.com/adafruit/Adafruit-PN532/blob/master/examples/ntag2xx_read/ntag2xx_read.ino

M5Stack SPI pinout :

#define PN532_SCK (18)
#define PN532_MOSI (23)
#define PN532_SS (16)
#define PN532_MISO (19)

I'm sure my wiring is okay because if I use the following library from Seeed Studio it WORKS!!! (the module is detected, cards readed, it is just complicated to use multiple devices on the SPI with it :s ) :
https://github.com/Seeed-Studio/PN532

Adafruit guys, dear LadayAda, are you sure this lib is really/still compatible with the ESP32?

I really want to use the Adafruit version, your support is great and your code too.
Regards.

Handshake, Ready and Delay.

In line 1604 is a delay(1) ;
That is after the WIRE.requestFrom() and after the first i2c_recv(), and before reading each byte of the following data.
However, that delay is not needed, since the Wire.requestFrom() is a complete I2C transmission on its own. All the data has been read and it waiting in a buffer in the Wire library.

Thesis

Hello,
I have a little question for you about data protection.
Can I please use your code on my thesis. --> Of course, I will mark you as creator of this wonderful solution.

Best wishes
zKingFabzz

ESP32 hardware SPI + PN532

Hello.

This line of code results in an error (infinite searching PN532) using hardware SPI (VSPI) in ESP32 module because transaction already started in begin function (duplicates start transaction). I resolved this issue by deleting this line.

SPI.beginTransaction(PN532_SPI_SETTING);

PN532DEBUGPRINT.println("TIMEOUT!");

Сообщение "TIMEOUT!" выводится каждый раз при инициализации в фукнции nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength, 1000);

Необходимо добавить условие, что только при DEBUG MODE будет выводится данное сообщение

if (timer > timeout) {

#ifdef MIFAREDEBUG
PN532DEBUGPRINT.println("TIMEOUT!");
#endif
return false;
}

Arduino Uno + PN532 Change UID on chinese clones (Arduino IDE 1.6.11)

Hi there,

I am working on a project which uses changeable UID cards and I would need to have a library on Arduino which could do that, but not using a different hardware like the RC522. The library from miguel balboa is very good in this respect, but it does not apply to the PN532.
I know that you could change the UID of the card using libnfc, but that could not work on Arduino because it needs a full OS to be installed.
I would therefore like to ask your help on writing such an example as we would find for the RC522.

I have inspected the PN532 code for mf-setuid and I have found that it would be possible to adapt the code for Arduino, so please see what I have managed to write so far:


/*-

 Based on Free/Libre Near Field Communication (NFC) library
 *
 * Libnfc historical contributors:
 * Copyright (C) 2009      Roel Verdult
 * Copyright (C) 2009-2013 Romuald Conty
 * Copyright (C) 2010-2012 Romain Tartière
 * Copyright (C) 2010-2013 Philippe Teuwen
 * Copyright (C) 2012-2013 Ludovic Rousseau
 * See AUTHORS file for a more comprehensive list of contributors.
 * Additional contributors of this file:
 * Copyright (C) 2011      Adam Laurie
 * Copyright (C) 2014      Dario Carluccio
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *  1) Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  2 )Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * Note that this license only applies on the examples, NFC library itself is under LGPL
 *
 */
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>

// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SCK  (13)
#define PN532_MOSI (11)
#define PN532_SS   (10)
#define PN532_MISO (12)

// If using the breakout or shield with I2C, define just the pins connected
// to the IRQ and reset lines.  Use the values below (2, 3) for the shield!
#define PN532_IRQ   (2)
#define PN532_RESET (3)  // Not connected by default on the NFC Shield

// Use this line for a breakout with a SPI connection:
Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);

// Use this line for a breakout with a hardware SPI connection.  Note that
// the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's
// hardware SPI SCK, MOSI, and MISO pins.  On an Arduino Uno these are
// SCK = 13, MOSI = 11, MISO = 12.  The SS line can be any digital IO pin.
//Adafruit_PN532 nfc(PN532_SS);

// Or use this line for a breakout or shield with an I2C connection:
//Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);



void setup() {
  Serial.begin(115200);

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.println("Did not find the shield...");
    while (true) {
    }
  }

  Serial.print("The classic: 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();

  nfc.begin();
}

// Defining the same variables as the libnfc-sample

#define SAK_FLAG_ATS_SUPPORTED 0x20

#define MAX_FRAME_LEN 264

static uint8_t abtRx[MAX_FRAME_LEN];
static int szRxBits;
static uint8_t abtRawUid[12];
static uint8_t abtAtqa[2];
static uint8_t abtSak;
static uint8_t abtAts[MAX_FRAME_LEN];
static uint8_t szAts = 0;
static size_t szCL = 1;//Always start with Cascade Level 1 (CL1)

bool    quiet_output = false;
bool    iso_ats_supported = false;

// ISO14443A Anti-Collision Commands
uint8_t  abtReqa[1] = { 0x26 };
uint8_t  abtSelectAll[2] = { 0x93, 0x20 };
uint8_t  abtSelectTag[9] = { 0x93, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t  abtRats[4] = { 0xe0, 0x50, 0x00, 0x00 };
uint8_t  abtHalt[4] = { 0x50, 0x00, 0x00, 0x00 };
#define CASCADE_BIT 0x04

// special unlock command
uint8_t  abtUnlock1[1] = { 0x40 };
uint8_t  abtUnlock2[1] = { 0x43 };
uint8_t  abtWipe[1] = { 0x41 };
uint8_t abtWrite[4] = { 0xa0,  0x00,  0x5f,  0xb1 };
uint8_t abtData[18] = { 0x01,  0x23,  0x45,  0x67,  0x00,  0x08,  0x04,  0x00,  0x46,  0x59,  0x25,  0x58,  0x49,  0x10,  0x23,  0x02,  0x23,  0xeb };
uint8_t abtBlank[18] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x36, 0xCC };


// Created my own transmit_bits method.
// I have replaced  transmit_bits with transmit_bytes, but I think that's wrong. 


static  bool
transmit_bits(const uint8_t *pbtTx, const size_t szTxBits)
{
  // Show transmitted command
    printf("Sent bits:     ");
    nfc.PrintHex(pbtTx, szTxBits);

    uint8_t responseLength = sizeof(abtRx);
  if (nfc.inDataExchange(pbtTx,szTxBits,abtRx,&responseLength)){
     printf("\nSuccess sending/receiving...");
    }
  else{
     printf("\nCommunication failed...Try again...");
    }  



  // Show received answer
    printf("Received bits: ");
    nfc.PrintHex(abtRx,&responseLength);


  // Succesful transfer
  return true;
}


void
iso14443a_crc(uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc)
{
  uint8_t  bt;
  uint32_t wCrc = 0x6363;

  do {
    bt = *pbtData++;
    bt = (bt ^ (uint8_t)(wCrc & 0x00FF));
    bt = (bt ^ (bt << 4));
    wCrc = (wCrc >> 8) ^ ((uint32_t) bt << 8) ^ ((uint32_t) bt << 3) ^ ((uint32_t) bt >> 4);
  } while (--szLen);

  *pbtCrc++ = (uint8_t)(wCrc & 0xFF);
  *pbtCrc = (uint8_t)((wCrc >> 8) & 0xFF);
}

/**
 * @brief Append CRC_A
 *
 */
void
iso14443a_crc_append(uint8_t *pbtData, size_t szLen)
{
  iso14443a_crc(pbtData, szLen, pbtData + szLen);
}






void loop(void) {

  uint8_t i;


   abtData[4] = abtData[0] ^ abtData[1] ^ abtData[2] ^ abtData[3];
   iso14443a_crc_append(abtData, 16);


  // Serial.println("Listening...");
  if (nfc.inListPassiveTarget()) {

    Serial.println("Something's there...");

memcpy(abtAtqa, abtRx, 2);

  // Anti-collision
  transmit_bits(abtSelectAll, 2);

  // Check answer
  if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
    printf("WARNING: BCC check failed!\n");
  }

  // Save the UID CL1
  memcpy(abtRawUid, abtRx, 4);

  //Prepare and send CL1 Select-Command
  memcpy(abtSelectTag + 2, abtRx, 5);
  iso14443a_crc_append(abtSelectTag, 7);
  transmit_bits(abtSelectTag, 9);
  abtSak = abtRx[0];

  // Test if we are dealing with a CL2
  if (abtSak & CASCADE_BIT) {
    szCL = 2;//or more
    // Check answer
    if (abtRawUid[0] != 0x88) {
      printf("WARNING: Cascade bit set but CT != 0x88!\n");
    }
  }

  if (szCL == 2) {
    // We have to do the anti-collision for cascade level 2

    // Prepare CL2 commands
    abtSelectAll[0] = 0x95;

    // Anti-collision
    transmit_bits(abtSelectAll, 2);

    // Check answer
    if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
      printf("WARNING: BCC check failed!\n");
    }

    // Save UID CL2
    memcpy(abtRawUid + 4, abtRx, 4);

    // Selection
    abtSelectTag[0] = 0x95;
    memcpy(abtSelectTag + 2, abtRx, 5);
    iso14443a_crc_append(abtSelectTag, 7);
    transmit_bits(abtSelectTag, 9);
    abtSak = abtRx[0];

    // Test if we are dealing with a CL3
    if (abtSak & CASCADE_BIT) {
      szCL = 3;
      // Check answer
      if (abtRawUid[0] != 0x88) {
        printf("WARNING: Cascade bit set but CT != 0x88!\n");
      }
    }

    if (szCL == 3) {
      // We have to do the anti-collision for cascade level 3

      // Prepare and send CL3 AC-Command
      abtSelectAll[0] = 0x97;
      transmit_bits(abtSelectAll, 2);

      // Check answer
      if ((abtRx[0] ^ abtRx[1] ^ abtRx[2] ^ abtRx[3] ^ abtRx[4]) != 0) {
        printf("WARNING: BCC check failed!\n");
      }

      // Save UID CL3
      memcpy(abtRawUid + 8, abtRx, 4);

      // Prepare and send final Select-Command
      abtSelectTag[0] = 0x97;
      memcpy(abtSelectTag + 2, abtRx, 5);
      iso14443a_crc_append(abtSelectTag, 7);
      transmit_bits(abtSelectTag, 9);
      abtSak = abtRx[0];
    }
  }

  // Request ATS, this only applies to tags that support ISO 14443A-4
  if (abtRx[0] & SAK_FLAG_ATS_SUPPORTED) {
    iso_ats_supported = true;
  }

  printf("\nFound tag with\n UID: ");
  switch (szCL) {
    case 1:
      printf("%02x%02x%02x%02x", abtRawUid[0], abtRawUid[1], abtRawUid[2], abtRawUid[3]);
      break;
    case 2:
      printf("%02x%02x%02x", abtRawUid[1], abtRawUid[2], abtRawUid[3]);
      printf("%02x%02x%02x%02x", abtRawUid[4], abtRawUid[5], abtRawUid[6], abtRawUid[7]);
      break;
    case 3:
      printf("%02x%02x%02x", abtRawUid[1], abtRawUid[2], abtRawUid[3]);
      printf("%02x%02x%02x", abtRawUid[5], abtRawUid[6], abtRawUid[7]);
      printf("%02x%02x%02x%02x", abtRawUid[8], abtRawUid[9], abtRawUid[10], abtRawUid[11]);
      break;
  }
  printf("\n");
  printf("ATQA: %02x%02x\n SAK: %02x\n", abtAtqa[1], abtAtqa[0], abtSak);
  if (szAts > 1) { // if = 1, it's not actual ATS but error code
    printf(" ATS: ");
    nfc.PrintHex(abtAts, szAts);
  }
  printf("\n");

  // now reset UID
  iso14443a_crc_append(abtHalt, 2);
  transmit_bits(abtHalt, 4);
  transmit_bits(abtUnlock1, 7);
 // if (format) {
 //   transmit_bits(abtWipe, 1);
  //  transmit_bits(abtHalt, 4);
   // transmit_bits(abtUnlock1, 7);
 // }
  transmit_bits(abtUnlock2, 1);
  transmit_bits(abtWrite, 4);
  transmit_bits(abtData, 18);
 // if (format) {
   // for (i = 3 ; i < 64 ; i += 4) {
   //   abtWrite[1] = (char) i;
    //  iso14443a_crc_append(abtWrite, 2);
    //  transmit_bits(abtWrite, 4);
    //  transmit_bits(abtBlank, 18);
  //  }
  }
  else {
    Serial.print("Trying again...");
  }
}


The code work up until the first transmit_bits command. I get the reponse 0x93 and 0x20 but I afterwards get and error with 0x81 which means there is a problem at the high level. I am thinking I must be missing a command of some sort.


The classic: Found chip PN532
Firmware ver. 1.6
Trying again...Trying again...Trying again...Trying again...Trying again...Trying again...Trying again...Tag number: 1
Something's there...
0x93 0x20
Don't know how to handle this command: 81
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x93 0x70 0x00 0x00 0x00 0x00 0x00 0x9C 0xD9
Don't know how to handle this command: 81
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Tag number: 1
Something's there...
0x93 0x20
Don't know how to handle this command: 81

If there are any volunteers for this, your help is much appreciated.

Thanks,
Cristian

strncmp is not working for binary arrays, use memcmp

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

100% uC use

This library use 100% uc task While waiting for a nfc tag, the timeout in the library don't let possibilities to multitask with this librairy easily. As I know , a librarie should Never going into a almost infinit loop inside of itself.

esp8266

Please add support for the esp8266 arduino platform

Found chip PN532
Firmware ver. 1.6
Waiting for an ISO14443A card

but nothing from the cards ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.