AnsweredAssumed Answered

How to erase stm32f429 flash sector in dual bank mode?

Question asked by mei.raymond on Mar 27, 2015
Latest reply on Mar 28, 2015 by mei.raymond
429 has 1M flash and I divide it into two banks using dual bank mode. Each has 512MB. 
I want to erase sector 15 (0x0808 C000 - 0x0808 FFFF) , but it fails. But if I use single bank mode and erase sector 8 (0x0808 0000 - 0x0809 FFFF), it operate correct. As below, I use the standard function in Cube.
Who can give me a tips on how to solve it?

uint32_t FLASH_EraseSector(uint32_t sectorAdd)
{
FLASH_EraseInitTypeDef EraseInitStruct;
uint32_t errSector = RET_OK;

HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();

/* Fill EraseInit structure*/
EraseInitStruct.TypeErase = TYPEERASE_SECTORS;
EraseInitStruct.VoltageRange = VOLTAGE_RANGE_3;
EraseInitStruct.Sector = FLASH_GetSector(sectorAdd);
EraseInitStruct.NbSectors = 1;
HAL_FLASHEx_Erase(&EraseInitStruct, &errSector);

HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
return errSector;
}

Outcomes