I am using the nfcpy
library to try writing NDEF records to a Type2Tag. Apparently these tags are not NDEF compatible. nfcpy
offers a format()
function which is supposed to make the tag NDEF compatible but it is not working. Is there a way to make these tags NDEF compatible? Or do I have the wrong kind of tag? All I know about my tags is that they are 1K cards.
Here is how I am trying to format the tags.
Python file:
import nfc
import nfc.ndef
def connected(tag):
print "format:", tag.format() # format tag to make it NDEF compatible
print "on card:", tag.ndef.message.pretty() if tag.ndef else "sorry, no NDEF"
return False
if __name__ == "__main__":
clf = nfc.ContactlessFrontend("usb:072f:2200")
print clf
clf.connect(rdwr={"on-connect": connected})
Output:
ACS ACR122U on usb:002:012
format: False
on card: sorry, no NDEF
I've had some issues here and there with the format() function too.
Some things to try:
See if you can format your tag using an NFC-enabled Android phone and the TagWriter app. This app is designed by one of the main NFC chip manufacturers. If this can't do it, nothing can.
If TagWriter can format your card, but nfcpy can't, debug a little more. I dug around in nfc/tag/tt2.py, and it returns False if the following line returns False: if self.ndef and self.ndef.is_writeable:
So definitely check the tag.ndef
and tag.ndef.is_writeable
for more info.