cancel
Showing results for 
Search instead for 
Did you mean: 

''FLASH_Erase_Sector()'' stalls erasing the bank2 sectors on the STM32F427IG

Henry Brasil
Associate II
Posted on January 08, 2018 at 12:14

Dear Sir, I am experiencing the following problem:

I am using the STM32F427IG configured via the DB1M option byte as 'dual bank' mode, so I have configured the flash as 512K on the bank1 and 512K on the bank2; the mcu VDD is 3.3V.

the following code works until I star to erase the bank2 sectors:

__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); //ok

HAL_FLASH_Unlock(); //OK

//BANK 1 SECTORS ERASE

FLASH_Erase_Sector(FLASH_SECTOR_5,FLASH_VOLTAGE_RANGE_3);// erase sector5 bank1, it works

FLASH_Erase_Sector(FLASH_SECTOR_6,FLASH_VOLTAGE_RANGE_3);// erase sector6 bank1, it works

FLASH_Erase_Sector(FLASH_SECTOR_7,FLASH_VOLTAGE_RANGE_3);// erase sector7 bank1, it works

//BANK 2 SECTORS ERASE

FLASH_Erase_Sector(FLASH_SECTOR_17,FLASH_VOLTAGE_RANGE_3);// erase sector17 bank1, stuck here

FLASH_Erase_Sector(FLASH_SECTOR_18,FLASH_VOLTAGE_RANGE_3);// erase sector18 bank1, 

FLASH_Erase_Sector(FLASH_SECTOR_19,FLASH_VOLTAGE_RANGE_3);// erase sector19 bank1,

HAL_FLASH_Lock();

it stalls here:

FLASH_Erase_Sector(FLASH_SECTOR_17,FLASH_VOLTAGE_RANGE_3);// erase sector17 bank1, stuck here

Can you help me? thanks

2 REPLIES 2
Doug Kehn
Senior
Posted on January 08, 2018 at 14:57

Which bank is executing code? A stall would be expected if the code is executing from bank2.

Posted on January 08, 2018 at 15:06

running from bank1 and writing to bank2 single sectors, I've found the issue, I need to put a 'wait for last operation function' between the sector writing.

thanks sir