cancel
Showing results for 
Search instead for 
Did you mean: 

Help with M24SR i2c CRC calculation

jyi1
Associate II
Posted on August 29, 2014 at 16:55

Hello,

I'm having trouble calculating the CRC when sending and receiving bytes via i2c from the M24SR.

I've tried following the example on page 29 from the application note on storing data in the NDEF memory

(

http://www.st.com/web/en/resource/technical/document/application_note/DM00105043.pdf

)

When I follow the CRC algorithm from wikipedia (

http://en.wikipedia.org/wiki/Cyclic_redundancy_check&sharpComputation

)

The calculated CRC does not match the expected CRC from the example.

Can someone please show step by step how to calculate the CRC?

For instance, how would I calculate the CRC if I try to send the command to read the CC file length?

Start bit 0xAC 0x02 0x00 0xB0 0x00 0x00 0x02 0x6B 0x7D Stop bit

What is the polynomial divisor? Is it 0x8005? From section 5.5 in the datasheet (

http://www.st.com/web/en/resource/technical/document/datasheet/DM00097458.pdf

), what does it mean that ''The initial register content shall be 0x6363 and the register content shall not be inverted after calculation''?

Thanks for any help,

Jon

#i2c #m24sr-crc-calculation #crc #m24sr
1 ACCEPTED SOLUTION

Accepted Solutions
ben2399
Associate
Posted on September 08, 2014 at 12:00

Hi,

You can find a working solution on page 20:

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00102751.pdf

exclude the I2C address for the data to generate the CRC

Add the two CRC bytes at the end.

First CRC lower byte followed by the CRC higher byte.

with kind regards,

Ben Schueler

View solution in original post

2 REPLIES 2
ben2399
Associate
Posted on September 08, 2014 at 12:00

Hi,

You can find a working solution on page 20:

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00102751.pdf

exclude the I2C address for the data to generate the CRC

Add the two CRC bytes at the end.

First CRC lower byte followed by the CRC higher byte.

with kind regards,

Ben Schueler

jyi1
Associate II
Posted on September 29, 2014 at 16:29

Hi Ben,

Thank you for the suggestion, the sample code has helped me solve my issue.

-Jon