This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Trying to read TI RF430CL330H dynamic tag with PN532 tag reader/writer

Other Parts Discussed in Thread: RF430CL330H, MSP-EXP430F5529LP

hi TI,

I have an arduino connected to adafruit pn532 shield. I powered on the TI dynamic tag with 3.3 power supply from the arduino. Now, this code is supposed to detect any card on the field and print something. 

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

    This example will wait for any ISO14443A card or tag, and
    depending on the size of the UID will attempt to read from it.
   
    If the card has a 4-byte UID it is probably a Mifare
    Classic card, and the following steps are taken:
   
    - Authenticate block 4 (the first block of Sector 1) using
      the default KEYA of 0XFF 0XFF 0XFF 0XFF 0XFF 0XFF
    - If authentication succeeds, we can then read any of the
      4 blocks in that sector (though only block 4 is read here)
   
    If the card has a 7-byte UID it is probably a Mifare
    Ultralight card, and the 4 byte pages can be read directly.
    Page 4 is read by default since this is the first 'general-
    purpose' page on the tags.


    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 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 <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) {
  //Serial.begin(115200);
  
  Serial.begin(9600);
  Serial.println("Hello!");
  
  pinMode(8, OUTPUT); 
  pinMode(9, OUTPUT); 

  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
        
        
        
        success = nfc.mifareclassic_ReadDataBlock(4, data);


        if(success){
         
         if(data[0] == 1){
       
                   digitalWrite(8, HIGH);
          digitalWrite(9, HIGH);
  
           
         }
        else
      {
      
                digitalWrite(8, LOW);
          digitalWrite(9, LOW);
  
        
      }  
        }
        
      
      delay(2000);


        // 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(10000);
        //}
        //else
        //{
         // Serial.println("Ooops ... unable to read the requested block.  Try another key?");
        //}
      }
      else
      {
        Serial.println("Ooops ... authentication failed: Try another key?");
      }
    }
    
   
  }
}

Please ignore mifare specific part but my concern is till "

success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

"

That function waits for any card in the field and returns success code. Now, my understanding is this function should work for TI dynamic tag as well. Here is the readPassiveTarget function from the adafruit library.

Now here carddaudrate is passed as 0 which will set baud rate to default as 106 kbps. I found it here

http://nfcip-java.googlecode.com/svn/trunk/nfcip-java/doc/ACR122_PN53x.txt

Also, this command is correct PN532_COMMAND_INLISTPASSIVETARGET; because i think TI dynamic tag is a passive target. So, my question is what can i be doing wrong that is preventing the pn532 to be detecting the TI dynamic tag? I appreciate your help very much!!!

boolean Adafruit_NFCShield_I2C::readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength) {
pn532_packetbuffer[0] = PN532_COMMAND_INLISTPASSIVETARGET;
pn532_packetbuffer[1] = 1; // max 1 cards at once (we can set this to 2 later)
pn532_packetbuffer[2] = cardbaudrate;

if (! sendCommandCheckAck(pn532_packetbuffer, 3))
{
#ifdef PN532DEBUG
Serial.println("No card(s) read");
#endif
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)");
#endif
while (wirereadstatus() != PN532_I2C_READY)
{
delay(10);
}

#ifdef PN532DEBUG
Serial.println("Found a card");
#endif

// read data packet
wirereaddata(pn532_packetbuffer, 20);

// check some basic stuff
/* ISO14443A card response should be in the following format:

byte Description
------------- ------------------------------------------
b0..6 Frame header and preamble
b7 Tags Found
b8 Tag Number (only one used in this example)
b9..10 SENS_RES
b11 SEL_RES
b12 NFCID Length
b13..NFCIDLen NFCID */

#ifdef MIFAREDEBUG
Serial.print("Found "); Serial.print(pn532_packetbuffer[7], DEC); Serial.println(" tags");
#endif
if (pn532_packetbuffer[7] != 1)
return 0;

uint16_t sens_res = pn532_packetbuffer[9];
sens_res <<= 8;
sens_res |= pn532_packetbuffer[10];
#ifdef MIFAREDEBUG
Serial.print("ATQA: 0x"); Serial.println(sens_res, HEX);
Serial.print("SAK: 0x"); Serial.println(pn532_packetbuffer[11], HEX);
#endif

/* Card appears to be Mifare Classic */
*uidLength = pn532_packetbuffer[12];
#ifdef MIFAREDEBUG
Serial.print("UID:");
#endif
for (uint8_t i=0; i < pn532_packetbuffer[12]; i++)
{
uid[i] = pn532_packetbuffer[13+i];
#ifdef MIFAREDEBUG
Serial.print(" 0x");Serial.print(uid[i], HEX);
#endif
}
#ifdef MIFAREDEBUG
Serial.println();
#endif

return 1;
}

  • Sanjay - 

    The RF430CL330H is an ISO14443B / NFC T4B based transponder, not an ISO14443A / NFC T4A or proprietary card (like Mifare Classic)

    The reference you made to to passive target is actually for Peer to Peer communication, not reader to transponder communication. 

    if you are unwilling to switch to http://www.dlpdesign.com/dlp-7970abp-ds-v11.pdf + http://www.ti.com/tool/msp-exp430g2 or http://www.ti.com/tool/msp-exp430f5529lp?DCMP=msp-f5529&HQS=msp-f5529-b, for your reader side, then you need to look for a download of code which is issuing a ReqB or WupB (called SENSB_REQ or ALLB_REQ, respectively, in NFC Forum-speak), then ATTRIB command to activate (gets PUPI) and select the device, in order to then retrieve data from the transponder memory.

    hope that helps you out. 

     

  • Thanks! I just checked into the NFC PN532 manual and it has information regarding various cards. My question is it has a section for ISO/IEC 14443-4 card. Is the RF430CL330H dynamic tag ISO 14443-4 card. My question is if ISO14443B and ISO/IEC 14443-4 are the same standards or are they completely different.

    Here is the link for the manual. (Page 131)

    http://www.nxp.com/documents/user_manual/141520.pdf

    Please let me know. Thank you again!

  • Sanjay - 

    the ISO14443 (-1, -2, -3 and -4) covers ISO14443A and ISO14443B tags. The -3 part of the standard is for activation and complete selection of B tags (only two commands are needed: REQB and ATTRIB.), while the fully compliant A tags require multiple -3 commands and also one command from -4 (called RATS) to be fully selected. The -4 part of the standard is for fully compliant A or B devices, like the RF430CL330H (as a Type B tag) and then operate using the framework from ISO14443-4 and commands from ISO7816-4.

     From the manual you sent the link for, you would set BrTy = 0x03 (see page 118) to get the device firmware to issue REQB and ATTRIB. 

    Then, while they conveniently don't have a really direct example shown in that document, after the Answer to ATTRIB comes back successfully, you would then use DEP to get info out of the RF430CL330H (or likewise, same thing for ISO14443A card which has been fully selected and is layer 4 compliant.

    Page 18 of the RF430CL330H data sheet shows an example of the flow ==> http://www.ti.com/lit/ds/symlink/rf430cl330h.pdf