NFC Data Exchange Formats, Frames & Examples
Advertisement
Introduction : In an NFC system, “Data Exchange” refers to the process where the Reader/Writer (e.g., TRF7970A) sends a command frame to a tag, and the tag responds with a data frame. While the physical modulation (ASK, FSK) differs by technology, the logical data is almost always wrapped in the NFC Data Exchange Format (NDEF). Below are the frame structures and exchange examples for the primary tag types supported by the TRF7970A. The contents on this page is based on the NFC/HF RFID reader/writer using the TRF7970A application report and standard NFC protocols.
1. Type 2 Tag Exchange (ISO/IEC 14443-3 Type A)
Type 2 tags (like MIFARE Ultralight) are simple memory storage devices. They do not use a file system; instead, they use a flat memory map divided into 4 byte pages.
- Protocol: ISO 14443-3 (106 kbps).
- Addressing: Data is read/written in blocks (pages).
- Key Feature: To detect NDEF data, the Reader must check the Capability Container (CC) in Block 3. The first byte must be 0xE1 (Magic Number).
Packet Example: Reading NDEF Data
- The Reader wants to read user data starting at Block 4. It sends a READ command.
Reader Request: Command 0x30
Format = | Cmd Code | Block Address | CRC (2 Bytes) |
Example Value = | 0x30 | 0x04 | 0xXXXX |
Here 0x30 : standard read command for Type-2 and ox04 is the starting block number.
Tag Response : 16 Bytes of Data
- Type 2 tags respond with 4 blocks (16 bytes) at once to improve efficiency.
Format = | Data (Block 4) | Data (Block 5) | Data (Block 6) | Data (Block 7) | CRC |
Example Values = | 03 0B D1 01... | ...User Data... | ...User Data... | ...User Data... | 0xXXXX |
- 0x03 : NDEF Message TLV (Tag Field)
- 0x0B : Length of the message (11 bytes)
- 0xD1 : NDEF Header (Start of Record, Short Record, Text Type)
2. Type 3 Tag Exchange (ISO/IEC 18092 / FeliCa)
Type 3 tags (like FeliCa Lite) use a different modulation scheme and structure. They are block based (16 bytes per block) but require a “Service Code” to access data.
- Protocol: NFC-F (212 or 424 kbps).
- Addressing: Attribute Information Block (Block 0) contains NDEF management info.
- Key Feature: Does not use a Capability Container (CC). Instead, Block 0 contains the Ver, Nbr (Number of blocks to read), and Nbw (Number of blocks to write).
Packet Example: CHECK (Read) Command
- The Reader requests to read Block 1 (where NDEF data often starts).
Reader Request :
Format = | Length | Cmd (Check) | IDm (Manufacturer ID) | No. of Services | Service Code List | No. of Blocks | Block List |
Example Values = | 0x10 | 0x06 | 0x01...08 (8 bytes) | 0x01 | 0x0B00 (Read Only) | 0x01 | 0x8001 |
- 0x06: The command code for “Read” in FeliCa.
- IDm: The unique ID of the tag (retrieved during activation).
- 0x0B00: Service code for NDEF data (Little Endian).
Tag Response :
Format = | Length | Resp Code | IDm | Status Flag | Block Data (16 Bytes) |
Example Values = | 0x1D | 0x07 | 0x01...08 | 0x00 0x00 | D1 01 07 54 02 65 6E... |
3. Type 4 Tag Exchange (ISO/IEC 14443-4)
Type 4 tags (like DESFire or some Java Cards) are “smart” tags. They use a file system and APDU (Application Protocol Data Unit) commands, similar to a credit card.
- Protocol: ISO-DEP (Data Exchange Protocol).
- Addressing: Select Application -> Select File -> Read Binary.
- Key Feature: You must “Select” the NDEF Application before you can read files. The NDEF Application ID (AID) is standardized as (D2 76 00 00 85 01 01).
Packet Example: Read Binary
- Assuming the NDEF file has already been selected (File ID usually 0xE104), the Reader asks for the data. Reader Request (C-APDU) :
Format = | CLA | INS | P1 (Offset High) | P2 (Offset Low) | Le (Expected Length) |
Example Values = | 0x00 | 0xB0 | 0x00 | 0x00 | 0x0F (15 bytes) |
- 0x00: Class (Standard).
- 0xB0: Instruction code for Read Binary.
- 0x00 00: Offset (start reading from the beginning of the file).
Tag Response (R-APDU):
Format = | Data Payload | Status Word 1 (SW1) | Status Word 2 (SW2) |
Example Values = | 00 0C D1 01... | 0x90 | 0x00 |
- 00 0C: The “NLEN” (NDEF Length) field, indicating the message is 12 bytes long.
- 90 00: Success status code (OK).
4. Type 5 Tag Exchange (ISO/IEC 15693)
Type 5 tags (Vicinity Cards) operate at a longer range but lower speed. They use a “Flags” byte at the start of every request to define data rate and addressing modes.
- Protocol: ISO 15693 (26.48 kbps).
- Addressing: 4 byte or 8 byte blocks.
- Key Feature: The TRF7970A must be set to 0x02 in the ISO Control Register (0x01) to handle the sub-carrier modulation for this tag.
Packet Example: Read Single Block
- The Reader wants to read Block 0 (the Capability Container).
Reader Request :
Format = | Flags | Cmd Code | UID (Optional) | Block Number | CRC |
Example Values = | 0x02 | 0x20 | (Omitted if non addressed) | 0x00 | 0xXXXX |
- 0x02: High data rate, Non-addressed mode (talks to any tag in silence).
- 0x20: Command for Read Single Block.
Tag Response :
Format = | Flags | Block Security Status | Data (4 Bytes) | CRC |
Example Values = | 0x00 | 0x00 (Not locked) | E1 40 40 00 | 0xXXXX |
- E1: The Magic Number indicating NDEF support
Summary
According to the application report, the TRF7970A acts as the Physical Layer (PHY). It does not automatically generate these headers (except for framing bits like SOF/EOF and CRC in some modes).
- MCU Responsibility: The microcontroller (e.g., MSP430) constructs the payload bytes shown in the examples above (Command, Address, Data).
- TRF7970A Responsibility: The MCU pushes this data to the TRF7970A FIFO. The TRF7970A adds the start/stop bits, calculates CRC (if configured), and modulates the RF field (13.56 MHz) to send the packet to the air.
References for Further Study
- Texas Instruments. NFC/HF RFID reader/writer using the TRF7970A (SLOA227B). (Primary Source).
- NFC Forum. NFC Digital Protocol Technical Specification. (Defines the low level bytes for Type 2, 3, 4, 5).
- ISO/IEC. ISO/IEC 14443 (Parts 3 & 4) and ISO/IEC 15693 (Part 3). (The international standards defining the command codes like 0x30 or 0xB0).
- Meyer, G. NFC Application Protocol Data Unit (APDU) Description. (For deep dives into Type 4 Tag interactions).
Advertisement
RF