freezing on stm32 for two second while erasing sector
Hello all,
I would like to write data to eeprom of stm32f413zh with stm32cube ide. I use HAL library to do this. I am able to write to eeprom correctly. But while erase function is running, microprocessor freezes for a while(one or two second). I tried with some function but result was same. when i remove HAL erase function, freezing doesnt happen. What can reason be?
void Flash_WriteData(uint32_t addr)
{
HAL_FLASH_Unlock();
FLASH_EraseInitTypeDef f;
uint8_t Size;
f.TypeErase = FLASH_TYPEERASE_SECTORS;
f.NbSectors = 1;
f.Sector = FLASH_SECTOR_15;
f.VoltageRange = FLASH_VOLTAGE_RANGE_3;
Size = 1;
uint32_t PageError = 0;
uint32_t data;
HAL_FLASHEx_Erase(&f, &PageError);
HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD , addr, data);
HAL_FLASH_Lock();
}
