cancel
Showing results for 
Search instead for 
Did you mean: 

Flash corrupted, showing ? (Question mark)

DVars.1
Associate II

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'?

7 REPLIES 7
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".

Unwritten or fails ECC, or beyond scope​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
alister
Lead

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.

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.

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.

Why sometimes the erase fail? Why ECC fail?

> Today i saw that sometimes the erase function returns error. Don't know why yet.

That would explain why some bits are 0.

If you feel a post has answered your question, please click "Accept as Solution".