Skip to main content
Visitor II
August 29, 2014
Solved

Help with M24SR i2c CRC calculation

  • August 29, 2014
  • 2 replies
  • 1828 views
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
    This topic has been closed for replies.
    Best answer by ben2399
    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

    2 replies

    ben2399Answer
    Visitor II
    September 8, 2014
    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

    jyi1Author
    Visitor II
    September 29, 2014
    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