Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.

trying to detect type B dynamic tags
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

trying to detect type B dynamic tags

by nondescript on Wed Feb 05, 2014 6:17 pm


I am trying to make pn532 detect the texas instruments dynamic tag that i am using. I would like to include this thread here as well since i was getting help from this thread as well. ... px#1111623

So the problem is i am using this tag from TI. ... link-pr-tf

I have tested it with my smartphone and it can easily detect this dynamic tag. That gives me confidence that the dynamic tag circuit is working.

Now, in the reader circuit i have my arduino hooked with pn532 as per the instruction. I am pretty sure the circuit is correct as with the example code, i can read the mifare tag pretty easily.

Now, the problem i am trying to overcome is i have been trying to detect the dynamic tag but with no success. Here is what i have tried so far.

First here is the code that i am using to detect the tag from arduino

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <Adafruit_NFCShield_I2C.h>

#define IRQ   (2)
#define RESET (3)  // Not connected by default on the NFC Shield

Adafruit_NFCShield_I2C nfc(IRQ, RESET);

void setup(void) {


  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
  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 a  card");


Now i know that this code straight doesn't work as the readPassiveTargetID function is made for type A tags if i understand the code i had to make the following change in the library..this is just for testing. According to PN532 manual, to detect type B tags it said to use 0x03 in BrTy field AFI should be 0 in initiator data.

In page, 115

Code: Select all | TOGGLE FULL SIZE
boolean Adafruit_NFCShield_I2C::readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength) {

  pn532_packetbuffer[0] = PN532_COMMAND_INLISTPASSIVETARGET; //4A
  pn532_packetbuffer[1] = 1;  // max 1 cards at once (we can set this to 2 later)
  pn532_packetbuffer[2] = 0x03; //cardbaudrate;
  pn532_packetbuffer[3] = 0x00; //cardbaudrate;
  if (! sendCommandCheckAck(pn532_packetbuffer, 4))
    #ifdef PN532DEBUG
   Serial.println("No card(s) read");
    return 0x0;  // no cards read
  // Wait for a card to enter the field
  uint8_t status = PN532_I2C_BUSY;
  #ifdef PN532DEBUG
  Serial.println("Waiting for IRQ (indicates card presence)");
  while (wirereadstatus() != PN532_I2C_READY)

  Serial.println("Found a card");

I cannot get the reader to detect the tag. It doesn't print anything when i check it in the serial monitor. Can i get some guide in this predicament? If this doesn't work i will have to buy TI's reader writer. :(
Posts: 4
Joined: Wed Dec 04, 2013 9:03 pm

Re: trying to detect type B dynamic tags

by adafruit_support_mike on Thu Feb 06, 2014 1:39 am

The PN532 has hardware support for type B tags, but our library only has code support for type A.

It's one of the limits we had to accept in order to keep the library size under control. Even the code we have now is too big to run on an Arduino using the ATmega168P.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

Posts: 61407
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.