Blankcheck fails after successful FLASH_Erase_Sector (HAL_FLASHEx_Erase) in STM32H743
I have a strange behaviour on a new project with a STM32H743 processor and I am currently stuck.
After a successful (HAL returns HAL_OK) erase operation of a flash sector (e.g Sector 4) the blankcheck routine - which worked on all of my other H743 projects - tells that still data is in that Flash memory.
But when I reboot the system, the flash actually was deleted and the dump now shows 0xFFFF values.
What could block reading back data from the Flash?
Why do I read back previously programmed data?
How can I ensure that data is actually read and not presented from a previous read operation or a buffer?
This is my blankcheck routine:
int FlashBlankCheck(DWORD FlashStartAddr,DWORD FlashEndAddr)
{
volatile uint64_t data64 = 0;
volatile uint32_t Adr;
Adr = (uint32_t)FlashStartAddr; /* set pointer to start address */
while (FlashStartAddr < FlashEndAddr) // Start z.B: 80000 End z.B. 0x9FFFF
{
data64 = *(uint64_t*)Adr;
__DSB(); // Data Synchronization Barrier (Daten-Blocken)
// It completes when all explicit memory accesses before this instruction complete.
// aus: Example fürs Flashen kopiert
if (data64 == 0xFFFFFFFFFFFFFFFF) // 64 Bit auf einmal lesen
{
Adr += 8; // increment Flash pointer
FlashStartAddr += 8; // increment Start address
}
else
return 0; // Flash not Blank
}
return 1; // Flash Blank
}
Any comments are very much appreciated!