0
votes

I writing an application in C# that writes a NDEF record to a MIFARE 1k tag. Im using the ACR122 contactless card reader to send APDU commands.

The record that I want to write is URI type, and it needs to be long, so thats where my problem begins.

So far Im able to write to whichever block I want, but I can only read what is written in the first sector (blocks 4,5 and 6). blocks 8 and 9 (second sector) have content but cannot be read.

Since I cant write to the sector block, i make the jump from block 6 to 8. So, Im not sure if I have to set a byte that indicates that the message continues on the other block.

Any thoughts?

Im using my android nfc enable to read the messages...

1

1 Answers

4
votes

The complete documentation on how NDEF messages are written to and read from MIFARE Classic tags is publicly available, see http://www.nxp.com/documents/application_note/AN1304.pdf and http://www.nxp.com/documents/application_note/AN1305.pdf.

What has to be done in your case boils down to:

  1. Write in sector 0 (= MIFARE Application Directory) in which sectors the NDEF message will be stored
  2. Write the bytes of the NDEF TLV into the data blocks of these sectors.

There is no need to add any management data to the data blocks containing the NDEF data. Be careful, though, to configure the different sector trailer blocks correctly, otherwise the NDEF message will not be detected correctly.