2021-06-29 03:19 AM
I am working with STM32CubeIDE on device STM32H743
I am working with the flash and sometimes the data inside them being corrupted, showing ?.
What may be the reason causing some of the memory to show ?.
How can i identify that without getting hardfault?
Why after using HAL_FLASHEx_Erase_IT, the data is '0' instead of '1'?
2021-06-29 06:37 AM
Probably the memory shows as ??? while a flash erase is ongoing. Bits should be 1 after an erase, perhaps you're not erasing what you intend to erase. Show some code or screenshots to better explain your situation.
2021-06-29 07:12 AM
Unwritten or fails ECC, or beyond scope
2021-06-29 05:09 PM
Reads of PCROP enabled areas return 0. A read would not cause a bus error, but would set the FLASH_SR1/2.RDPERR1/2 flag. Could also check for it by seeing if PCROP is enabled in PROT_AREA_START1/2 and PROT_AREA_END1/2 in FLASH_PRAR_CUR1/2 with STM32CubeProgrammer or similar. An area is enabled if PROT_AREA_END1/2 > PROT_AREA_START1/2. A full bank is enabled if PROT_AREA_END1/2 = PROT_AREA_START1/2.
2021-06-30 05:23 AM
I erase the the correct sector, i checked that and it usually works so it is the correct place. I do the regular flaw as i so in many examples:
FLASH_EraseInitTypeDef pEraseInit=
{
.Banks = FLASH_BANK_2,
.NbSectors = 2,
.Sector = Sector_0,
.TypeErase = FLASH_TYPEERASE_SECTORS,
.VoltageRange = FLASH_VOLTAGE_RANGE_3
};
uint32_t error_sector;
status = HAL_FLASH_Unlock();
if (status != HAL_OK) return status;
status = HAL_FLASHEx_Erase(&pEraseInit, &error_sector);
if (status != HAL_OK) return status;
status = HAL_FLASH_Lock();
if (status != HAL_OK) return status;
-------------------------------------------------------------------------
All off that after initializing the HAL and system clock.
Today i saw that sometimes the erase function returns error. Don't know why yet.
2021-06-30 05:26 AM
The PCROP is not active, the START is 0xff and END is 0x00. i think it is not functional on the sectors i am using.
I am using the 2 first sectors of the second bank.
2021-06-30 05:31 AM
Why sometimes the erase fail? Why ECC fail?
2021-06-30 06:42 AM
> Today i saw that sometimes the erase function returns error. Don't know why yet.
That would explain why some bits are 0.