How do I write data to a Type2 tag?

Asked by Juan Trujillo

I'm struggling writing data to a Type2 tag (KAMOR NFC TAG 203)... Please help!!!

Here is the snippet of code I'm using:

import nfc

def connected(tag):
  print tag
  if tag.is_present:
    print "Tag is present"
    s = bytearray(b"HHHH")
    print "Data written to tag"
    print s

clf = nfc.ContactlessFrontend('tty:AMA0:pn53x')
clf.connect(rdwr={'on-connect': connected})

Am I missing something? Do I need to format the tag? I'm using a similar code to read it and it always return the same value...

Thanks in advance!

Question information

English Edit question
nfcpy Edit question
No assignee Edit question
Solved by:
Stephen Tiedemann
Last query:
Last reply:
Revision history for this message
Best Stephen Tiedemann (stephen-tiedemann) said :

The first 12 bytes (blocks 0-2) of a Type 2 Tag are not writeable. Bytes 12-15 (block 3) is bitwise one-time programmable (set bits can never be unset). Ordinary memory starts at byte 16.

Revision history for this message
Juan Trujillo (juancarlos-trujillo) said :

Thanks Stephen Tiedemann, that solved my question.