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.

combine the utilization of ecc and esm, create a one bit ecc error

Other Parts Discussed in Thread: HALCOGEN

Dear Experts

At present, I understand how ecc works and I am aware of the connection between ecc and esm.

In respect of flash ecc, I enable the ecc in startup.c 

flashWREG->FEDACCTRL1 = 0x000A060AU;

 _coreEnableFlashEcc_();

and  do the ecc checking :

checkFlashECC();
flashWREG->FDIAGCTRL = 0x000A0007U;

and I enable the one bit ecc error esm channel interrupt, so I guess if I have a one bit error in my flash, after execting these statements, the esm interrupt notification function will be entered, then I know  one bit ecc error occured and I can do anything I want there. (will the wrong 64 bits  flash value be corrected automatically?)

but I have a problem: if have to testify my program, i have to see these code can function as we expected.

how to deliberately  generate a one bit ecc error in flash in some place I specified ? then i can observe the correction procedure?

Best Regards

Leo

  • Hi,

      I will suggest you reference the HalCoGen generated code. First go to HalCoGen and under the SAFETY INIT tab select the 'Enable Flash ECC Check' checkbox. Once the code is generated you can find the API fmcECCcheck() in the sys_selftest.c. The generated code will perform ECC check as part of the startup. You can call fmcECCcheck() again if you want in you application code. This will be the easiest way for you.

  • Hi Charles
    I have already done what you said, my question is how to deliberately inject a fault into the flash, make one bit inverted to test my code.
    Leo
  • But the code generated by Halcogen, it used the checkFlashECC() instead of the fmcECCcheck() you mentioned.
    Confused about the difference between them
    Leo
  • There are two different ECC logic. One is inside the CPU and another one is inside the flash controller. When you read instructions or data from the normal flash banks the ECC checked by the CPU. When you read data from the OTP sectors and the EEPROM emulation bank then the ECC is checked by the ECC logic inside the flash wrapper.

    So if you want to verify the ECC logic inside the CPU you will use the checkFlashECC(). If you want to verify the ECC logic inside the flash wrapper you will use fmcECCcheck().
  • Charles
    Excellent explanation.
    All the best
    Leo