This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

what can CRC be used for exactly?

Dear All

It said that CRC can be performed to verify the integrity of memory system. But I have no idea how to do that.

Can I use CRC to check all my flash , fee as ECC does?

Can I use CRC to protect my communication with peripherals, such as I2c, sci,can  ?

where the CRC signatures were stored ?(ecc are stored in flash or ram)

Thanks for anwering.

Leo

  • Hi Leo,

    I will suggest that you start off with the wikipedia for how CRC works in theory to get a feel for it en.wikipedia.org/.../Cyclic_redundancy_check

    Basically there is a maximum-length PSA register constructed based on a 64-bit primitive polynomial in Hercules devices. Whenever the CPU writes a value to it, the PSA register will generate a signature. Due to the nature (some math involved) of the polynomial chosen, the signature is unique. Let's say you want to check the integrity of the flash, what you can do is for the CPU (you can also use DMA) to read the flash and write to the PSA register. Let's say you have 3MB of flash and you will read these 3MB word by word and write to the PSA register word by word. At the end of the 3MB there is one unique signature corresponding to the the 3MB of unique data. Let's supposed for whatever reason the flash memory is losing its data retention and also suppose that you did not enable ECC. After the CPU reads the 3MB of data and write to the PSA register the CRC module will calculate a different signature which is different from your golden signature. Since the signature does not match, you know that there is something wrong with the flash but you don't know which address is bad.

    Some protocol is already built in with CRC like CAN. Normally you would not use this CRC-64 for the communication channel as some communication dictates certain types of polynomial for communication.

    You can store the golden signature in the flash.
  • Dear  Charles

    I understand what you said. And your flash CRC verification is a good example, actually when I ask this question, I try to answer it.

    I know it can do verify the flash, fee.

    Indeed, I shoud ask this question is this way:  any irreplaceable role CRC can play in  a safety-critical product ? In what occasion, or due to what safety requirement, CRC must or would be better to be used?

    You have answered  me a great many questions, maybe you have found that our group is working on a product applied for SIL4. So my manager ask me to invetigate and research on the safety issues. He what me to use the full capabilities of TMS570 safety highlight.

    So last week, I went through the safety diagnose lib, stc ,pbist,sefe test, ecc, lock step , etc.  The only two independent modules related to safety are CRC and  DCC.

    So if I donot use them, I must convince these two modules have noting to do with our product and cannot improve reliability, and I should tell him CRC should be used with something in order to to something.

    In my opinion, CRC is a very good checker, I can be used as flash checker. But I assumed that it does not have advantages over ECC in perspective of memory protection. If I already have ECC for my flash, fee, and ram, CRC then looks excessive and unnecessary. As you said, our product use SCI, i2C, can communication, but they all have their own protection mechanism. If you say CRC controller can be used as a calculator of signature,  actually, it is not very difficult to have CRC algorithm in software, then CRC controller can only reduce the consumption of CPU.

    So what CRC is designed for  and can not be replaced?

    Sorry for my poor English, it may challenge you.

    Best Regards

    Leo

  • Hi Leo,
    What I will suggest you do is to go through the Safety Analysis Report and to use the FMEDA tool to calculate your FIT rate and Diagnostic coverage per your safety case to see if you are able to reach your safety goal without using the CRC module as one of the available diagnostics.

    I want to give you another example of using CRC. Let's say you have a group of critical control registers that you want to make sure they don't change during runtime. The changing states of these registers may introduce latent faults with a bad consequence on your application. The registers are not ECC protected. So if the flip flops change states due to radiation you will not know. Here is where CRC can be used as a diagnostic against these registers.

    BTW, your English is very good!
  • Also, ECC checks that the last value written to flash is not corrupted. And it only looks across 64-bits at a time. It is an online test so it is very valuable for fast error detection.

    But what if for some reason, the value last written to flash isn't correct? What if it is wrong because of a bootloader bug, or because a bad firmware got released outside of process control, or maybe you have the FEE setup incorrectly and it programs the wrong bank, or maybe someone hacked the system, etc., etc. etc...

    CRC gives you a signature by which you can identify an image like a thumbprint - so it can still be valuable for identifying the integrity of an image.
  • Dear Anthony
    Thank you for your wonderful explanation, I have never thought about this, your answer widen my vision.
    Ragards
    Leo
  • Dear Charles
    It is always joyful to obtain knowledge from you guys. You are right, we have overlook the "Safety Analysis Report " and related tools and techniques. I understand now that using more tms570 safety tools doesnot mean more safer of my product.
    Thank you so much for these valuable answer.
    Best Regards
    Leo