Hey guys,
First post here, and I'm pretty new to I2C.
As the title implies, I'm having difficulty communicating with an M24SR64-Y NFC tag by ST. It's an NFC shield, and the module is called: X-NUCLEO-NFC01A1.
So far, all I've been trying to do, is to read data from the NFC tag itself, to see if the information I've stored in the tag corresponds to what read from the Arduino. The Information has been stored onto the tag using ST's M24SR android app found on the Play Store.
I'm just generally having trouble understanding whether I'm communicating with tag in the right way, or not. According to the Datasheet, (section 7.8 ), when addressing the tag, you have the addresses: 0xAC and 0xAD.
With the Wire-library only doing 7-bit addressing, if you do the I2C scanner, you will find that the addresses you can write to are 0x56 and 0x2D, which correspond to 0xAC (LSB removed) and 0xAD (MSB removed). So far so good.
The thing is. From what I understand and according to the datasheet, is that there are a couple of "Functional Procedures" (Section 8.) that have to be executed by NFC tag, before you can read any information saved on the tag.
When sending commands to the tag, from what the datasheet refers to as C-APDU (payload format)-> consisting of data-blocks such as an I-Block, it seems like you're supposed to expect a response.
Am I supposed to expect an0 R-APDU (payload) to be sent data back to the arduino?
There is this homepage I've been referring to, a lot. The homepage uses an ST Microcontroller for its example, however, the commands that are being sent back and forth between the MCU and the NFC tag, are the exact same. Going off of the homepage's examples, there appears to be data sent back to the MCU after every "functional procedure" (command) has been sent to the NFC tag. You can find the homepage here:
http://www.nfcdynamictag.com/m24srcookbook
Another thing worth mentioning, it appears that there is a CRC operation at the end of each sent command. And when reading about the functional procedures (Section 8, datasheet), there appears to be password protection on the NDef files. I have made sure, with the android app, to remove all password protection, but I cannot help but wonder if there is a default 0x00000... password on the NDEF files.
There appears to be a german guy, who has made a library for communicating with M24SR, but it no longer works for the newest Arduino IDE. Here is his blog (german) and Github:
In the source code, he appears to be doing a CRC 16 operation. But when I do the same, and check an online CRC 16 calculator, my results are drastically different from what is to be expected (according to the data sheet - see section 7.9.1 NDef tag application command, and try doing a CRC check on the SOD field and Payload field together).
If you're wondering however, no - I do not have experience with CRC algorithms, as of yet. So I really need help ![]()
Long story short, my first I2C project is killing me. So any help would be highly appreciated. Also, if anyone has any resources that I could check up on, I would definitely appreciate it.
I have attached my code and the datasheet to this post
If the datasheet doesn't work: here's the link:
Thanks in advance
Btw, I'm aware that this is horrible code, but as of right now I'm just trying to get something to work. Have I gone blind over the basics?
NFC_test2.ino (4.4 KB)