Strange internal FLASH reading after sector erase.
Hi there!
Experimenting FLASH reading/writing I done a fanny test that is giving an unexpected (to me) result.
Basically:
1) I defined 2 32 bytes buffers (aRbuff for read, and aWbuff for write)
u32t aWbuff[8U] = {
0x00010203, 0x04050607, 0x08090A0B, 0x0C0D0E0F,
0x10111213, 0x14151617, 0x18191A1B, 0x1C1D1E1F
};
volatile u32t aRbuff[8U] = {0};
2) I implemented my read, write and erase function and i integrated them into the main infinite loop
if(bIsErase == TRUE)
{
EraseFLASHsectors(uiADRtest, uiSect2Erase);
bIsErase = FALSE;
}
if(bIsWrite == TRUE)
{
printf("Writing FLASH memory...\r\n");
WriteFLASHdata(uiADRtest, aWbuff, 32U);
bIsWrite = FALSE;
}
if(bIsRead == TRUE)
{
printf("\r\n");
printf("Reading flash...\r\n");
ReadFLASHdata(uiADRtest, aRbuff, 8U);
printf("0x%08X, 0x%08X, 0x%08X, 0x%08X,\r\n", aRbuff[0], aRbuff[1], aRbuff[2], aRbuff[3]);
printf("0x%08X, 0x%08X, 0x%08X, 0x%08X,\r\n", aRbuff[4], aRbuff[5], aRbuff[6], aRbuff[7]);
bIsRead = FALSE;
}
Writing a FLASH word and reading it back works fine, but if I perform a sector erase and then I read newly the FLASH location I get the pattern I write previously... It seems the erase hasn't done!

But if i reset the MCU and connect again, reading the location gives al 0xFFFFFFFF, so erase has been performed.
Since Im working on the M7 core of a stmH755ZI, I'm in doubt that is a problem of cache coherence, and I tryed to address it in software without luck.
Since sutch topic is just a little cryptic to me, anyone has an idea?
iTTy
