cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, it is possible to detect last code line before reset IWDG MCU?

lorant124
Associate III

I have FW with implementation 2 uart IT, I2C, FATFS, MSC etc.

If I do not use IWDG everything is good, works fine I tested it 72 hour without freezing or other problems FW is worked smooth.

But if I set IWDG after few hours running (4-8h) IWDG reset MCU.

I tried add everywhere:

HAL_IWDG_Refresh(&hiwdg)

And I tried IWDG set to maximum (Reload = 4095, Prescale to 256 ) but happens the same.

Please help, thank you

2 REPLIES 2
T J
Lead

I am not sure that the callstack remains visible after a reset.

However,

you cant add HAL_IWDG_Refresh everywhere, that is the point of the watchdog.

It is supposed to be running in the foreground only.

and not in any tasks.

If you could make a variable, declared globally... kept in a place which is not overwritten by reset.

then in all of your tasks, just write a different constant to the variable...

coming out of reset, you will know which module was last running.

Well one could fish through memory/stack in Reset Handler before your startup code trashes it. Won't know where it was, or registers. Instrument your code so you understand the flow. Write waypoint data into a known location.

Consider using a TIM to implement a faux watchdog, and have it Fault with diagnostic if you haven't kicked it frequently enough.

Have a periodic interrupt record profiling information.

>>I tried add everywhere

Kinda defeats the point.

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