The command that you are using,
E0 00 00 60 <Lc> 01 01 <Byte address> <Length> <Data>
writes data bytes starting at block 3 of the emulated NFC Forum Type 2 tag. Thus, the byte address 0x00
addresses the first byte of block 3.
The problem that you are facing is that you only write the NDEF message itself starting at block 3 (byte 0). However, an NFC Forum Type 2 tag needs further metadata. Specifically, block 3 is the capability container block. For the specific memory layout presented by the ACR1252U, the CC block would need to be filled with the value
E1 10 06 00
(if write access should be allowed) or
E1 10 06 0F
(if other NFC devices should treat the tag as read-only).
E1
is the magic number indicating that this is an NFC Forum tag, 10
refers to version 1.0 (the current version) of the data mapping defined by the NFC Forum Type 2 Tag Operation specification, and 06
indicates that the tag has a total of 12 data blocks.
Further, you need to wrap the NDEF message into an NDEF Message TLV block. The NDEF Message TLV block has the tag 0x03
. Thus, the wrapped NDEF message would look like this:
03 0F D1010B5501676F6F676C652E636F6D
The tag memory, that you need to write would therefore look like this:
E1 10 06 00
03 0F D1 01
0B 55 01 67
6F 6F 67 6C
65 2E 63 6F
6D
Finally, you should fill the tag memory to full blocks by placing a Terminator TLV (tag 0xFE
, no length) at the end and filling the remaining bytes with zeros (0x00
). This also applies to the case where the data is already aligned to full blocks but there is further (empty) blocks beyond the end of your data.
E1 10 06 00
03 0F D1 01
0B 55 01 67
6F 6F 67 6C
65 2E 63 6F
6D FE 00 00
Thus, you would want to use the following write command to store the data on the emulated Type 2 tag:
E0 00 00 60 1C 01 01 00 18 E1 10 06 00 03 0F D1 01 0B 55 01 67 6F 6F 67 6C 65 2E 63 6F 6D FE 00 00
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…