2019-12-12 03:17 AM
I am working to generate the CRC for the flash memory, During this I am facing hard fault when the CRC module tries to read from certain flash locations, to debug it I made a small loop which assigns the value of each 4 byte. I found that reading at certain locations results in hardfault.
I tried with different starting address, I found that
when starting address is 0x08000000 hardfault occurred at 0x08000440
when starting address is 0x08001000 hardfault occurred at 0x0800144c
when starting address is 0x08004000 hardfault occurred at 0x080044cc
uint32_t *d1 = 0x08000000;
while(length){
uint32_t temp = *d1;
d1++;
length -= 4;
}
Any Idea of what is causing this issue?
2020-09-14 05:09 PM
It seems to be caused after writing to the sector.
I'm flashing the same way every time but apparently, in some cases, the write results in an (ECC?) error, that generates hard-faults if read. STM32CubeProgrammer will also fail to read the sector, and must be erased in order to recover. HAL always returns OK.
HAL_FLASH_Unlock();
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, 0x081E0000 + (32*fw), (uint32_t)(pSrcBuffer)) != HAL_OK)
{
// ERROR!
while ( 1 );
}
HAL_FLASH_Lock();
2021-06-12 11:16 PM
I had the same hard fault from random flash addresses when reading. It happened, when I wrote a flash word (32 bytes) with HAL_FLASH_Program, to an address in flash to which I already wrote, but with erasing the sector first with HAL_FLASHEx_Erase. Then the next read caused the hard fault. But not necessary at the location where I wrote. I guess something related to ECC. Tested with a NUCLEO-H723ZG board.
2022-11-17 03:34 AM
Hello,
same issue. Even the STM32CubeProgrammer fail to read. Do you find a solution?
2024-06-18 02:05 AM
Hi,
Did you fix this issue?
I also have the same situation recently. Read the Flash sector after writing will end up with a hard fault.
It seems many folks see this kind of issue, any one from ST to look into it?
2024-11-28 11:20 AM
Hi,
I have the same problem with a STM32WLE5CC6 version.
I use some part of the flash to read and write for storing critical data during hardfault or power down.
Write now some of the production devices have this problem... I write a code to make a dump of the memory and i get the exactly same result. The device is restart / get in hardfault, after reading couple of pages.
Looking that thread looks like the problem is big. Now from my statistics from production devices this problem happened to about 4 in 3000. Hope not to see the problem on other devices.
Also looking for a way to recover the device from that problem. ( Probably erasing the sectors ? i don't know)
Best regards and patience,
Nikos
2024-11-28 11:46 AM - edited 2024-11-28 11:47 AM
Would probably watch writing .ELF or .HEX as these have voids, vs a .BIN without.
Writing portions of flash lines.