NFC Forum Tags and NDEF template

Overview

Use the NDEF Data Template to read the content of either a card formatted according to the NFCForum Tag specification, or to receive a message through NFC beam (SNEP over LLCP).

Configuration

Lookup list (LKL register)

Register 03t0 (1 byte) selects the template.

Value Meaning Notes
40 Receive NDEF by SNEP (peer-to-peer)
41 Read NDEF from NFC Forum type 1 Tags
42 Read NDEF from NFC Forum type 2 Tags
43 Read NDEF from NFC Forum type 3 Tags
44 Read NDEF from NFC Forum type 4 Tags (A & B)
4A Read NDEF from NFC Forum type 4A Tags
4B Read NDEF from NFC Forum type 4B Tags
4E Read NDEF from any NFC Forum Tag
4F Read NDEF from any NFC Forum Tag and Receive NDEF by SNEP (peer-to-peer)

Size and format of output (TOF register)

Register 03t1 (2 Bytes) defines the output format.

When the NDEF Data template is selected, only “Long String” mode is supported.

The NDEF Record's Payload must contain only valid ASCII bytes. The reader transmits the lettersuntil either a zero value is read (00, i.e. '\0' i.e. the “end of string” char) or the specified length isreached.

Bytes Bits Content
0 7 Byte swapping:
0 : Send the data “as is”
1 : Reverse the data before sending (last char first)
6 Mode (raw/decimal or string)
String mode → must be 1
5 Fixed length:
0 : Variable length (no padding)
1 : Padd with ' ' chars (SPACE) on the right until the max output length is reached
4 Short/long string mode
Long string mode → must be 1
3-0 (unused)
Must be 0000
1 7 (unused)
RFU (must be 0)
6-0 Output length (max):
From 1 to 255 chars, 0 means “no limit”

Prefix (PFX register)

Register 03t2 defines the output prefix.

Please refer to Output prefix register

Miscellaneous options (OPT register)

If register 03t4 is set, the reader adds a token to its output to tell the receiver what kind of object has been read.

Bytes Bits Meaning
0 7-4 RFU
3-2 Position of the “card type” token in the output
00: Before the PFX constant
01: After the PFX constant, but before the actual data
10: After the actual data
11: RFU
0-1 Add a “card type” token to the output
00: Do not add the “card type” token
01: Add a 4F as “card type” token
10: Add a N as “card type” token
11: Add 00

Type name and format (TNF register)

Register 03t5 defines which data must be read.

Value Meaning Notes
01 Read a NFC Forum well-known record (NFC RTD)
02 Read a Media record (RFC 2046)
03 Read an absolute URI (RFC 3986)
04 Read a NFC Forum external record (NFC RTD)
53 Read a SpringCard data entry
54 Read a Text
55 Read a URI
FF Read either a SpringCard data entry, a URI or a Text

If value is be between 00 and 50 TYP register contains the actual type, otherwise TYP register must remain empty.

Type (TYP register)

The register 03t6 to select the NDEF Record you want to read. Please refer to the specifications of NFC Forum NDEF Data and Records, and to the specifications of the MIME Media, to provide a valid TNF,TYP combination.

For instance, two valid TNF,TYP combinations are:

  • TNF=01, TYP=55 (“U”): this is a URI as specified in NFC Forum's “RTD URI” specification. Note that in this case the raw URI is returned, which is not the case when TNF=55
  • TNF=02, TYP=74 65 78 74 2F 70 6C 61 69 6E (“text/plain”): this is a Media record, the MIME type is plaintext

Use cases and examples

Using TNF and TYP registers to select the data from an NDEF record

Reading a URI

If TNF=55 (and TYP is empty), the Reader tries to read either

  • An absolute URI record (RFC 3986),
  • A URI record according to the NFC Forum “RTD URI” specification,
  • A URI record within a smartposter record according to the NFC Forum “RTD SmartPoster” specification

In the first case, the record's content is returned “as is”. In the two later cases, the record's content is expanded into a real URI string according to the NFC Forum “RTD URI” specification. The Reader supports the ASCII character set only. Valid characters are 20 to 7F only.

Note that the Reader stops when the first valid URI is found in the NDEF message. It is not possible to read a later record.

Reading a Text

If TNF=54 (and TYP is empty), the Reader tries to read either

  • A text media (RFC2046 with MIME type set to “text/plain”),
  • A Text record according to the NFC Forum “RTD Text” specification,
  • A Text record within a smartposter record according to the NFC Forum “RTD SmartPoster” specification

In the first case, the record's content is returned “as is”. In the two later cases, the “lang” part of the Text content is removed.

The Reader supports the ASCII character set only. Valid characters are 20 to 7F only. Note that the Reader stops when the first valid Text is found in the NDEF message. It is not possible to read a later record. It is not possible to select a particular “lang” value.

Reading a SpringCard data entry

If TNF=53 (and TYP is empty), the Reader tries to read a Media record having type “text/xspringcard-scan-data”.

Reading a custom data entry

Set TNF=02 and use a custom MIME Media type (in TYP) to access your custom data. In this mode, the Reader supports only reading ASCII string. Therefore, your custom data shall be in the “text/” family.