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")
    tag.write(0,s)
    print "Data written to tag"
    print s

clf = nfc.ContactlessFrontend('tty:AMA0:pn53x')
print(clf)
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

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

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 :
#2

Thanks Stephen Tiedemann, that solved my question.