Solution for PN532 Writing URL into NFC Tag
is Given Below:
I’m trying to write a URL into NFC tag NXP Ntag213 using the “Raspberry PI 3b+ on Waveshare PN532 NFC HAT” platform in SPI mode.
An example URL would be: https://sun.byn/?id=046cd2baa75e56
Using the sample Python code from the Waveshare PN532 Wiki, I have managed to read and write data in blocks (of 4 bytes).
Block 6 has: [209, 1, 36, 85] –> [0xD1, 0x01, 0x24, 0x55] (the header)
Block 7 to 15 contains the URL –> I’m splitting the data in blocks of 4 bytes and calling pn532.ntag2xx_write_block()
Could you please answer these questions for me? Thank you!
-
Is the above method to write a URL correct? Also, to meet the 4th byte requirement, I’m adding 2 spaces at the end of the URL…is this okay to do?
-
How do I erase what was written? I was thinking of writing all 0s, but read somewhere that writing random data amounts to erasing.