Hello,
We want to do ECC inject test in EEPROM in MPC5744P, I try to refer the example MPC5744P_1b+2b_FLASH_ECC_error_injection-v0_1-GHS614 as below, and interlock write the address of mid block 0 flash 0x00808000 data to 0x00450000 and 0x00580000, but the ECC error is not occured, Could you help to check my code if is correct, or have other method to do ECC inject test for mid block 0/1 in MPC5744P EEPROM?
register uint32_t test_read_7 = 0;
/* Generate flash ECC error */
// step1. unlock all blocks (for simplicity)
C55FMC.LOCK0.R = 0;
C55FMC.LOCK1.R = 0;
C55FMC.LOCK2.R = 0;
C55FMC.LOCK3.R = 0;
// step2. erase the EEPROM mid block 0 (0x00808000 - 0x0080FFFF)
C55FMC.MCR.B.ERS = 1;
C55FMC.SEL0.R = 0x00000001; // select the EEPORM mid block 1
*(unsigned int*)0x00808000 = 0xFFFFFFFF; //interlock write
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.ERS = 0;
// step3. program data
C55FMC.MCR.B.PGM = 1;
*(unsigned int*)0x00808000 = 0x00450000; //interlock write
*(unsigned int*)0x00808004 = 0x00000000;
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.PGM = 0;
// step4. over-program data - this generates ECC error
C55FMC.MCR.B.PGM = 1;
*(unsigned int*)0x00808000 = 0x00580000; //interlock write
*(unsigned int*)0x00808004 = 0x00000000;
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.PGM = 0;
// step 5. now here the ECC is checked and non-correctable error found
test_read_7 = *(unsigned int*)0x00808000;
//test_read = *(unsigned int*)0x00808004;
Thank you.
Richard