0

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...

NFC guy
  • 10,151
  • 3
  • 27
  • 58
Israel Silva
  • 1
  • 1
  • 1

1 Answers1

4

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.

NFC guy
  • 10,151
  • 3
  • 27
  • 58
  • Ok, thank you for the answer. I've read the documentation available on the nxp.com site, but I must have skipped some details. I haven't written anything in the MAD directory yet, maybe this is what's missing. I will try your suggestion and come back with my results this week. Thanks!!! – Israel Silva Aug 05 '12 at 23:04
  • Hi, i have a mifare 1K tag and a ACR122U reader. I am able to write and read blocks normally. Now, I need to write a NDEF message. Do I need format the mifare 1K nfc tag before? Can you tell me how do you wrote NDEF to tag? Any code will be appreciated. – Luiz Alves Apr 07 '16 at 19:01