2024-09-20 03:02 PM - last edited on 2024-11-12 04:00 AM by SofLit
I am attempting to temporarily disable Flash ECC interrupts, for the purpose of validating data stored on internal flash, and discovered that the ECC Interrupt Enable settings seem to have no effect.
I am using an STM32H743, and have used the code below to intentionally trigger ECC interrupts. I experience the same interrupt (HardFault_IRQ), with the same FLASHn_SR values when a byte with an ECC mismatch is read, whether or not FLASH_CR_SNECCERRIE and/or FLASH_CR_DBECCERRIE are set. I have verified the bit settings via ST-Link/V2 ISOL debugger both before and after the interrupt occurs, and I'm using STM32CubeIDE.
// CODE FOR INTENTIONALLY TRIGGERING ECC ERROR
char dummy[32];
char * pointer = (char*) FLASH_BANK2_BASE;
flash_eraseSector(FLASH_SECTOR_TOTAL);
memset(dummy,0xAF,sizeof(dummy));
HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, FLASH_BANK2_BASE, (uint32_t)dummy);
dummy[0] = *pointer; // does not trigger ECC interrupt
memset(dummy,0x5A,sizeof(dummy));
HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, FLASH_BANK2_BASE, (uint32_t)dummy);
dummy[0] = *pointer; // triggers ECC interrupt
Does anyone know anything about this? Is there another register than must be used?
2024-11-12 02:51 AM
Hello @NickFF,
For the FLASH_CR_SNECCERRIE and FLASH_CR_DBECCERRIE interrupts to be effective, the LOCK2 bit should be cleared to 0.
Check:
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.