Solved
M24SR64 and Arduino
Posted on June 12, 2014 at 18:55
Hi I am using an Arduino UNO board to make an application to read the data of my M24SR64 antenna using I2C protocol. The problem is that I don't know if I am already communicating with it. I know from the datasheet that the address to read from a M24SR64 is 0xAD.
Here is the code of the Arduino UNO so I can read the data&sharpinclude <Wire.h>void setup(){ Serial.begin(9600); Wire.begin(); Serial.println(eepromRead()); }void loop(){}byte eepromRead(){ Wire.beginTransmission(0xAD); // Opens I2C communication with M24SR64 Wire.write(0); Wire.endTransmission(); Wire.requestFrom(0xAD, 1); while(!Wire.available()) { } return Wire.read();}I have also read in the datasheet that in order to read an NDEF file I have to Send the SelectNDEFTagApplication command, Select the CC file, Read the CC file, Select the NDEF file and Read the NDEF file. The problem here is that I don't know how to send all those commands using the Arduino and to which direction I have to send them. I really need help to interpret some data from the datasheet. I also attach an image of the oscilloscope when I update the code above when the Arduino and the M24SR64 are connected and I asked from the address 0xAD 1 byte. You can see that 4 bytes are being read. The first one is a 0xB4 and it is generated when I begin the transmission with address 0xAD, the next one is the zero I write with the command Wire.Write(0), the next byte is a 0xB6 and it is generated with the command Wire.requestFrom(0xAD,1). And the last byte it is the byte that I am asking for in the command Wire.requestFrom(0xAD,1). If I may have asked for 2 bytes, then 2 0xFF would appear at the end of the oscilloscope. I don't know if I am already communicating with the M24SR64 antenna with those data.I would be very thankful if you could help me. This is for a job I have to do this summer for the company I am working with. #arduino #m24sr