2025-05-15 8:41 AM
I have the following function to verify that a full flash sector is erased but the code never seems to exit this function and I believe it gets stuck at the point where I dereference the address value. What could be the issue?
static bool check_sector_erased(uint32_t sector_base) {
bool ret = true;
uint32_t sector_end = sector_base + SECTOR_SIZE;
uint32_t addr_val = 0;
for (uint32_t address = sector_base; address < sector_end; address += 4) {
addr_val = (*(volatile uint32_t*)address);
if (addr_val != ERASED_32) {
ret = false;
break;
}
}
return ret;
}
Solved! Go to Solution.
2025-05-15 1:41 PM
Update, I was reading virgin memory in high cycle flash which cause the ECCD to trigger an NMI. I suppose my follow up question would be is there a way to temporarily disable the interrupt instead of handling it? Setting the ECCNMI_MASK_EN bit in the SBS_ECCNMIR didn't seem to achieve anything.
2025-05-15 1:41 PM
Update, I was reading virgin memory in high cycle flash which cause the ECCD to trigger an NMI. I suppose my follow up question would be is there a way to temporarily disable the interrupt instead of handling it? Setting the ECCNMI_MASK_EN bit in the SBS_ECCNMIR didn't seem to achieve anything.
2025-05-15 2:44 PM
I suspect you could just return instead of infinite looping..
Which part# specifically are you using?
2025-05-15 2:48 PM
I'm using an H533. I have it set up now to have a global disable_eccd flag that, when set true, causes the NMI to clear the register and return. This works but I feel like it'd be cleaner if there was a way to disable NMI for the error temporarily altogether so was just wondering.