2021-10-07 03:07 AM
Hi ..
I am using this function to erase some sectors on the flash
bool FLASH_EraseSectors(uint32_t starting_sector , uint8_t number_of_sectors)
{
FLASH_EraseInitTypeDef erase_init;
uint32_t page_error;
/* Erase the user Flash area */
erase_init.Banks = FLASH_BANK_1;
erase_init.TypeErase = FLASH_TYPEERASE_SECTORS;
erase_init.NbSectors = number_of_sectors;
erase_init.Sector = starting_sector;
erase_init.VoltageRange = FLASH_VOLTAGE_RANGE_3;
/* Unlock the Flash to enable the flash control register access *************/
FLASH_Unlock();
if (HAL_FLASHEx_Erase(&erase_init, &page_error) != HAL_OK)
{
FLASH_Lock();
return false;
}
if (HAL_FLASHEx_Erase(&erase_init, &page_error) == HAL_OK)
{
FLASH_Lock();
return true;
}
}
I would like to erase some sectors without breaking the 2 tasks running...
The point is that it seems to destroy the tasks...
Is there a safe way to delete the sectors in flash during a task execution in FREERTOS ?
Thanks a lot
Solved! Go to Solution.
2024-01-05 07:00 AM
If it's blocking then how can this FLASH_WaitForLastOperation run after FLASH_Program_Word?
2024-01-05 07:03 AM
By stalling do you mean it stops until erase is done? Not permanently stalling I guess.