cancel
Showing results for 
Search instead for 
Did you mean: 

M24LR16E - I2C communication

adina
Associate
Posted on May 14, 2014 at 15:03

Hello,

I wish to use the M24LR16E as a NFC tag. In order to do this I have an ANT1-M24LR16E, a CR95HF and an Aardvark for the I2C communication.

With the M24LRxx_Application_Software I send a text through the RF (with the CR95HF) and then I am trying to change this text through the I2C with the Aardvark.

The batch code below:

<aardvark>

  <configure i2c=''1'' spi=''0'' gpio=''0'' tpower=''1'' pullups=''1''/>

  <i2c_bitrate khz=''400''/>

  <i2c_write addr=''0x53'' count=''2'' radix=''16''  >  00 00</i2c_write>

  <i2c_write addr=''0x53'' count=''4'' radix=''16''  >  E1 40 FF 05 </i2c_write>

  <i2c_write addr=''0x53'' count=''4'' radix=''16'' >  03 09 D1 01</i2c_write>

  <i2c_write addr=''0x53'' count=''4'' radix=''16''  > 05 54 02 65</i2c_write>

  <i2c_write addr=''0x53'' count=''4'' radix=''16''  > 6E 64 61 FE</i2c_write>

   <i2c_write addr=''0x53'' count=''2'' radix=''16'' > 00 00</i2c_write>

  <i2c_read addr=''0x53'' count=''16''/>

</aardvark>

The bytes read by the Aardvark(I2C) are the ones previously written through the RF.

I don't seem to be able to change them. Can you tell me if there is more to the I2C protocol that I missed in the datasheet?

Best regards, 

Adina

#m24lr #m24lr #m24lr-read-write-problem #m24lr16e #aardvak
1 ACCEPTED SOLUTION

Accepted Solutions
Anais GALLIGANI
Senior II
Posted on May 16, 2014 at 14:16

Hi Adina,

Regarding the batch code and how parameters are sent to the Aardkvard reader, I suspect a mistake in your programming sequence :

For read sequence, your batch code shows :

   <i2c_write addr=''0x53'' count=''2'' radix=''16'' > 00 00</i2c_write>

  <i2c_read addr=''0x53'' count=''16''/>

That means the reader send :

START + 0xA6 + 0x00 + 0x00 STOP (it could be better NOT to send STOP Here)    +   START+ 0xA7 + read 16 bytes

Where A7 is device select for a send command,  00 00 is address 0xA6 is device select for a receive data command

This is Ok and can work. If you have a way to avoid sending te STOP at the end of the first

<i2c_write add>

it could be better.

For write sequence, your bach code shows :

  <i2c_write addr=''0x53'' count=''2'' radix=''16''  >  00 00</i2c_write>

  <i2c_write addr=''0x53'' count=''4'' radix=''16''  >  E1 40 FF 05 </i2c_write>

That means the reader send :

START + 0xA6 + 00 + 00 + STOP    +    START+ 0xA6 + E1 + 40 + FF + 05 + STOP

That is not compliant with I2C write sequence described in the datasheet

To be able to write E1 40 FF 05  at address 00 00 , you need to send :

START + 0xA6 + 00 + 00 E1 40 FF 05 STOP

That could be :

<i2c_write addr=''0x53'' count=''6'' radix=''16''  > 00 00 E1 40 FF 05 </i2c_write>

                <i2c_write addr=''0x53'' count=''6'' radix=''16'' >  00 04 03 09 D1 01</i2c_write>

                <i2c_write addr=''0x53'' count=''6'' radix=''16''  > 00 08 05 54 02 65</i2c_write>

                <i2c_write addr=''0x53'' count=''6'' radix=''16''  > 00 0C 6E 64 61 FE</i2c_write>

I hope this will solve the issue

View solution in original post

1 REPLY 1
Anais GALLIGANI
Senior II
Posted on May 16, 2014 at 14:16

Hi Adina,

Regarding the batch code and how parameters are sent to the Aardkvard reader, I suspect a mistake in your programming sequence :

For read sequence, your batch code shows :

   <i2c_write addr=''0x53'' count=''2'' radix=''16'' > 00 00</i2c_write>

  <i2c_read addr=''0x53'' count=''16''/>

That means the reader send :

START + 0xA6 + 0x00 + 0x00 STOP (it could be better NOT to send STOP Here)    +   START+ 0xA7 + read 16 bytes

Where A7 is device select for a send command,  00 00 is address 0xA6 is device select for a receive data command

This is Ok and can work. If you have a way to avoid sending te STOP at the end of the first

<i2c_write add>

it could be better.

For write sequence, your bach code shows :

  <i2c_write addr=''0x53'' count=''2'' radix=''16''  >  00 00</i2c_write>

  <i2c_write addr=''0x53'' count=''4'' radix=''16''  >  E1 40 FF 05 </i2c_write>

That means the reader send :

START + 0xA6 + 00 + 00 + STOP    +    START+ 0xA6 + E1 + 40 + FF + 05 + STOP

That is not compliant with I2C write sequence described in the datasheet

To be able to write E1 40 FF 05  at address 00 00 , you need to send :

START + 0xA6 + 00 + 00 E1 40 FF 05 STOP

That could be :

<i2c_write addr=''0x53'' count=''6'' radix=''16''  > 00 00 E1 40 FF 05 </i2c_write>

                <i2c_write addr=''0x53'' count=''6'' radix=''16'' >  00 04 03 09 D1 01</i2c_write>

                <i2c_write addr=''0x53'' count=''6'' radix=''16''  > 00 08 05 54 02 65</i2c_write>

                <i2c_write addr=''0x53'' count=''6'' radix=''16''  > 00 0C 6E 64 61 FE</i2c_write>

I hope this will solve the issue