Showing results for 
Search instead for 
Did you mean: 

HAL_FLASH_Program & Watchdog compatible ?

Associate II


I have several programm where I use either the HAL_FLASH_Program command or some EEPROM command like EE_ReadVariable16bits (directly issued from the std "eeprom_emul.h" library).

To make those command functionnal i had to stop the watchdog which triggering even if I increase the time to some higher values (I have prescaler = 256, and reload = 1000 thus having a 8s delay ...)

Do you what could the issue to make both working together ? 




Depending on the part, and the size of the blocks chosen, the erase can take multiple seconds. The MCU will stall if you try to interact with the FLASH whilst it is busy.

You'd need to move all the code the MCU is expected to execute into RAM (including vector tables, interrupt handlers, etc)

Add a real EEPROM, or QSPI NOR Flash, Rethink your use/mechanics for saving things this way, vs NVRAM

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

Hi !

I don't think the time is the issue as the HAK_FLASH_PROGRAMM doesn't take long (mesured around 10ms.)
So the watchdog shall not trigger (8s) . 
I could break everything to move code to other places but I don't really get why this would change the behaviour.

Thank you for your explanations,