"Hey bro, what's up ?"
I'm in trouble with NDEF message formatting.
I went through the NFC forum to know how to build a NDEF message with a single NDEF record (text RTD) with a payload, so I can program my tag (M24LR16E) through I2c.
In addition to this, I programmed my tag with an external writer to have an example of a well formatted record.
Then I programmed my tag through I2C with the exact same value, and everything worked well. Changing the payload characters gave me the proof of my success =)
"But you didn't come here to show us that anything worked well, no?"
You're right, know I'm trying to change the payload length and I get troubles. As soon as I change the PAYLOAD_LENGTH of the NDEF record it is no more recognized anymore as one. I changed the PAYLOAD_LENGTH from 10 down to 5, so it's not a problem of overflowing the config field.
"Great story, show me some code/config"
Here is my record configuration :
- "Header" (MB ME CF SR IL TNF) : 0xD1
- PAYLOAD_LENGTH : 0x0A
- TYPE LENGTH : 0x01
- TYPE : 0x54
- PAYLOAD :
- 0x02 ; UTF-8, 2 byte language code
- 0x65 ; e
- 0x6E ; n
- 7 Other boring bytes
Also, I noticed that if I override the 6 bytes before my NDEF message, the NDEF message isn't recognized anymore. I have no idea on what could be this data as the NFC specification doesn't talk about this, neither the tag datasheet.
"You're supposed to ask a question..."
Uh, well...
- Is there anything else than the PAYLOAD_LENGTH field of the NDEF record that I should change?
- What are those essential data before my NDEF message?
My reader: Nexus 4 with NXP's "TagInfo" app