0
\$\begingroup\$

I am reading about CRC algorithms. And have a few basic doubts

Referred Link

I have 3 questions :

  1. Suppose, I have a Microcontroller and an EEPROM. I have read that CRC employs different algorithms. So, my question, how to check if the data sent by the Microcontroller with Checksum will be decoded by the EEPROM correctly, if the Microcontroller employs a different protocol and the EEPROM employs a different protocol to code and decode a checksum? Is the checksum coding and decoding algorithm the same or how to check?

  2. Is checksum done for all data transactions or only specific data transactions? Is it a mandatory thing to do for each data transfer?

  3. Last question, Is checksum only done for data values or address values too?

\$\endgroup\$
11
  • \$\begingroup\$ EEPROMs don't decode a CRC checksum - they will store it and the MCU can check to see that the EEPROM data integrity is correct by recalculating the CRC from the EEPROM data and comparing it with the original stored value. No mention (CTRL-F) of EEPROMs in the linked document. \$\endgroup\$
    – Andy aka
    May 19, 2020 at 15:40
  • \$\begingroup\$ Thank you. For a different IC which can decode the checksum, how is my question 1 tackled? \$\endgroup\$
    – Newbie
    May 19, 2020 at 15:44
  • \$\begingroup\$ If you have a specific EEPROM, state which it is, to know what CRC it uses natively. Not many EEPROMS use hardware CRC so you are free to use whatever CRC or any other hashing algorithm you want. \$\endgroup\$
    – Justme
    May 19, 2020 at 15:45
  • \$\begingroup\$ No. I donot have a specific EEPROM. I just wanted to state one example with some IC to understand the concepts and doubts I had \$\endgroup\$
    – Newbie
    May 19, 2020 at 15:53
  • \$\begingroup\$ @Justme , From your comment, are you saying there are two types of CRC - Native CRC in the Chip and the Hardware CRC ? \$\endgroup\$
    – Newbie
    May 19, 2020 at 15:56

1 Answer 1

1
\$\begingroup\$
  1. Use the same algorithm on your MCU. That also includes initial constants and data size - if the algorithm works on UINT8, don't use INT32.
  2. That depends on the specific device, you didn't specify which one is it, so we can't know.
  3. See #2.
\$\endgroup\$
6
  • \$\begingroup\$ Could you explain a bit more on point 1, please/ \$\endgroup\$
    – Newbie
    May 19, 2020 at 15:07
  • \$\begingroup\$ If the EEPROM uses CRC-16 with seed of 0x1234, you should use CRC-16 with seed 0x1234. \$\endgroup\$
    – Lior Bilia
    May 19, 2020 at 15:11
  • \$\begingroup\$ Sorry, I am new to this subject only depending on Application notes. I do not understand what you mean by 0x1234 \$\endgroup\$
    – Newbie
    May 19, 2020 at 15:17
  • \$\begingroup\$ 0x1234 is a hexadecimal number. \$\endgroup\$
    – Justme
    May 19, 2020 at 15:38
  • 1
    \$\begingroup\$ @Newbie Seed means to which value the CRC is initialized before calculations. And you already have answers to your three questions, your questions are just so general that they can't be answered more precisely unless you have a precise question. Explaining how CRCs work could fill a book. Please do some own research as well. \$\endgroup\$
    – Justme
    May 19, 2020 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.