STM32 MCU stucks after power cut-off
Here is my process :
- I supply my board with an USB cable.
- Then I flash my stm32L4 with a segger / st-link.
- My firmware goes in shutdown mode.
- I unplug the USB cable. Thus the power is suddently off.
- After that, I wire a battery to my device. Thus the MCU is powered.
In most of the case (90%), the device wakes up once the battery is wired (normal behaviour). However in some cases, the device does not wake up at all (Voltage is OK).
I'm using IWDG, thus MCU should restart if stuck. But in this case device seems totally stuck in the Reset_Handler (quite sure it is here). I need to pull down the NRST to GROUND to unstuck the device.
Is this because of the power cut-off ?
Can I add some firmware feature to avoid this behaviour ?
Note : quite similar problem but closed without reply : https://community.st.com/s/question/0D50X00009XkXkoSAF/stm32f410-freeze-after-power-supply-failure-of-70-ms-watch-dog-doesnt-reset-