2020-11-19 02:42 AM
I am implementing a custom bootloader for STM32F767 controller. Bootloader and application are in different sectors and on an update bootloader erases the application's sector and writes a new one. This works well, but sometimes the bootloader fails to clear the application's sector properly. Further attempts to clear it keep on failing. I can manually clear that sector with STVP and bootloader is then able to flash a new update there just fine.
Any help is appreciated.
Thanks
if(HAL_FLASH_Unlock() != HAL_OK)
return FALSE;
FLASH_EraseInitTypeDef flashErase =
{
.TypeErase = FLASH_TYPEERASE_SECTORS,
.Sector = FLASH_SECTOR_5,
.NbSectors = 1,
.VoltageRange = FLASH_VOLTAGE_RANGE_4
};
HAL_FLASHEx_Erase_IT(&flashErase);
Solved! Go to Solution.
2020-11-26 03:26 PM
Voltage range 4 and double word programming/erase is not for a normal usage. RM0410 section 3.3.5 tells it clearly. Flash program/erase operations blocks code execution from flash anyway, therefore there is almost no use of interrupts for those operations. Again - read the reference manual section 3.3.3!
2020-11-19 05:37 AM
Any reason you're using HAL_FLASHEx_Erase_IT instead of HAL_FLASHEx_Erase?
2020-11-19 09:22 PM
The device has internal watchdog running that was resetting the device when I used HAL_FLASHEx_Erase.
2020-11-26 03:26 PM
Voltage range 4 and double word programming/erase is not for a normal usage. RM0410 section 3.3.5 tells it clearly. Flash program/erase operations blocks code execution from flash anyway, therefore there is almost no use of interrupts for those operations. Again - read the reference manual section 3.3.3!
2020-12-16 04:23 AM
Thanks for your comment. This was an overlook from my side. It works fine with reduced voltage range. Thanks again.