nRF5 SDK v12.1.0
Data format

This information is not required to program the NFC tag; you can just follow the steps outlined in Programming a tag. The following sections provide background information about how the tag data is stored in the Type 2 Tag.

The NFCT data is stored in RAM, in the same way as data for other nRF52 peripherals. The data format that is implemented by this library is compliant to the Dynamic Memory Structure defined in the NFC Forum document "Type 2 Tag Operation Specification Version 1.1".

The Type 2 Tag memory has a size of 1024 bytes. It is organized in the following way:

Block Number Byte0 Byte1 Byte2 Byte3 Type
0 Internal 0 Internal 1 Internal 2 Internal 3 Reserved
1 Internal 4 Internal 5 Internal 6 Internal 7 Reserved
2 Internal 8 Internal 9 Lock 0 Lock 1 Reserved
3 CC 0 CC 1 CC 2 CC 3 Reserved
4 Data 0 Data 1 Data 2 Data 3 Data
5 Data 4 Data 5 ... ... Data
... ... ... ... ... Data
15 ... ... Data 46 Data 47 Data
16 Data 48 Data 49 ... ... Data
17 ... ... ... ... Data
... ... ... ... ... Data
251 ... ... ... Data 991 Data
252 Lock Lock Lock Lock Lock
253 Lock Lock Lock Lock Lock
254 ... ... ... ... Lock
255 Lock Lock Lock Rsvd Lock

There are three block types:

Static reserved

The static reserved bytes contain 10 internal bytes, 2 lock bytes, and 4 Capability Container bytes.

Internal bytes

The internal bytes are set according to the ISO/IEC 14443-3 standard. See the following table for a detailed description:

Byte number Value
Internal0 UID0
Internal1 UID1
Internal2 UID2
Internal3 BCC0 = CT ^ UID0 ^ UID1 ^ UID2
Internal4 UID3
Internal5 UID4
Internal6 UID5
Internal7 UID6
Internal8 BCC1 = UID3 ^ UID4 ^ UID5 ^ UID6
Internal9 NFC Lib version

UID0 contains the manufacturer ID for Nordic Semiconductor and equals 0x5F.

CT stands for Cascade Tag byte and equals 0x88.

The UID bytes are stored in the nRF52 FICR registers (see the nRF52832 Product Specification).

If you want to use UID bytes other than the ones from the FICR registers, use the nfc_t2t_internal_set function with a pointer to your own internal bytes as argument. If you modify these values, ensure that the following registers are consistent, which means that they have the same UID bytes:

Lock bytes

Both lock bytes (Lock 0 and Lock 1) are set to 0xFF, which means that the CC area and the data area of the tag can be read only, not written.

CC bytes

The Capability Container bytes (CC 0 - CC 3) are encoded as described in Section 6.1 of the Type 2 Tag Operation Specification. They cannot be used for storing application data. See the following table for the values of the CC bytes:

CC Byte Number Meaning Value
CC0 NFC magic number 0xE1
CC1 Document version number (v1.1) 0x11
CC2 Size of data area (992 bytes / 8) 0x7C
CC3 R/W access (read only) 0x0F

Data

Application data is organized in TLV blocks. The data area can contain one or more TVL blocks, up to a maximum data size of 992 bytes.

A TLV block contains the following fields:

The following block types are defined:

TLV block name Value of T field Description
NULL TLV 0x00 Can be used for padding of memory areas. The NFC Forum Device shall ignore this.
Lock Control TLV 0x01 Defines details of the lock bits.
Memory Control TLV 0x02 Identifies reserved memory areas.
NDEF Message TLV 0x03 Contains an NDEF message.
Proprietary TLV 0xFD Contains tag proprietary information.
Terminator TLV 0xFE Contains the last TLV block in the data area.

To write data to the tag, use the Type 2 Tag library functions nfc_t2t_payload_set or nfc_t2t_payload_raw_set. nfc_t2t_payload_set configures a single NDEF TLV block based on a user-provided NDEF message. nfc_t2t_payload_raw_set does not configure a TLV block, but the provided data must be organized in a TLV structure.

Lock and reserved

15 dynamic lock bytes are located after the data area. They are set to 0xFF to indicate that the tag is read only.

The lock bytes are followed by 1 reserved byte (Rsvd) to get a multiple of 8 bytes.


Documentation feedback | Developer Zone | Subscribe | Updated