Other Parts Discussed in Thread: HALCOGEN
I am executing the below code taken from self_test.c and it is always hitting the fail condition, i.e. single bit error is not detected.
ECC logic has been enabled in the CPU and flash module prior to calling this function.
flashBadECC is set as 0x20000000
Any ideas why this is not working?
/* @fn void checkFlashECC(void)
*
* This function checks Flash ECC error detection logic.
* The checkFlashECC function uses the flash interface module's diagnostic mode 7
* to create single-bit and double-bit errors in CPU accesses to the flash. A double-bit
* error on reading from flash causes a data abort exception.
* The data abort handler is written to look for deliberately caused exception and
* to return the code execution to the instruction following the one that was aborted.
*/
static void checkFlashECC(void)
{
/* Routine to check operation of ECC logic inside CPU for accesses to program flash */
volatile uint32 flashread = 0U;
/* Flash Module ECC Response enabled */
flashWREG->FEDACCTRL1 = 0x000A060AU;
/* Enable diagnostic mode and select diag mode 7 */
flashWREG->FDIAGCTRL = 0x00050007U;
/* Select ECC diagnostic mode, single-bit to be corrupted */
flashWREG->FPAROVR = 0x00005A01U;
/* Set the trigger for the diagnostic mode */
flashWREG->FDIAGCTRL |= 0x01000000U;
/* read a flash location from the mirrored memory map */
flashread = flashBadECC;
/* disable diagnostic mode */
flashWREG->FDIAGCTRL = 0x000A0007U;
/* this will have caused a single-bit error to be generated and corrected by CPU */
/* single-bit error not captured in flash module */
if ((flashWREG->FEDACSTATUS & 0x2U) == 0U)
{
selftestFailNotification(CHECKFLASHECC_FAIL1);
}
else
{
/* clear single-bit error flag */
flashWREG->FEDACSTATUS = 0x2U;
/* clear ESM flag */
esmREG->SR1 = 0x40U;