Read NDEF message with external NFC reader ACR1252

2019-02-28 17:27发布

问题:

I am using the following command to read a binary block from a Mifare Ultralight tag: FF B0 00 01 04

But now I want to exact the NDEF message stored in that Mifare Ultralight tag using an ACR1252 NFC reader. Which command do I have to use to get the full NDEF message? On which position in the tag is the NDEF message stored?

回答1:

MIFARE Ultralight tags map to the NFC Forum Type 2 Tag Operation specification (broken link, here is an alternative. Consequently, in order to extract the NDEF message from such a tag, you would need to follow the read procedure defined by that specification.

You already found the read command for your reader:

FF B0 00 BLOCK_NUMBER 10

With that command (note the value 0x10 for the length field) you read 4 consecutive blocks starting at BLOCK_NUMBER.

You would then first read the capability container (located at block 3):

FF B0 00 03 10

The first 4 bytes (1 block) are the capability container:

  • Byte 0 is set to the "magic" value 0xE1 to indicate that the tag uses an NDEF mapping following the NFC Forum Type 2 Tag Operation specification.
  • Byte 1 indicates the mapping version.
  • Byte 2 indicates the memory size of the tag.
  • Byte 3 indicates access restrictions.

Once you verified that the tag matches the NDEF mapping specification, you can read data starting at block 4 (you already read blocks 4-6 with the above command). Those blocks contain the NDEF message in a TLV structure with the tag 0x03. See Writing NDEF data to NTAG216 tag using low-level NFC communication methods for details on TLV structures.