Hi Gordon - Only just got around to looking at this one again - it seems to be working now (for whatever reason...)
I have a much better understanding of how this all works too - I'm working on a way today read the data transmitted via NFC and action upon it based on whether it matches an expected format.
I've got reading and writing working fine - but I'm tripping over the format of the data that's actually being sent. I'll spill my thoughts here, in case anyone else stumbles across this.
When a 'write' command is sent to the chip, (if it complies to NTAG213/215/216) it'll be formatted like so:
[[command code] [address of data to be changed] [data] [crc]]
Pretty basic so far. But the NFC writer app that I'm using to test actually writes some prefix and suffix data, which makes it hard to find the data that I have specified to be written, as it is surrounded by metadata. Here is an example of a write sent to the chip (actually ends up being 4 write commands):
new Uint8Array([162, 4, 3, 10, 209, 1]).buffer
new Uint8Array([162, 5, 6, 84, 2, 101]).buffer
new Uint8Array([162, 6, 110, 112, 111, 111]).buffer // <-- my data, following the 110, in ASCII
new Uint8Array([162, 7, 254, 0, 0, 48]).buffer
So the question I'm looking into is, what is the prefix/suffix data? And even if I wish to ignore this, there is no callback function on the tag to detect that it has finished being written to, so it's hard to locate my data afterwards - or even know when afterwards is.
I'll keep the thread posted, for archive sake!