Skip to main content
etour.1
Associate II
Jul 25, 2023 12:21 PM UTC
Question

HAL_FLASH_Program & Watchdog compatible ?

Hi, 

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 ? 

thanks,

Edgar

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
Jul 25, 2023 12:38 PM UTC

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
etour.1
etour.1Author
Associate II
Jul 25, 2023 2:43 PM UTC

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,

Edgar