Skip to main content
lorant124
Associate II
November 3, 2018
Question

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

  • November 3, 2018
  • 2 replies
  • 630 views

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

    This topic has been closed for replies.

    2 replies

    T J
    Senior III
    November 3, 2018

    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.

    Tesla DeLorean
    Guru
    November 3, 2018

    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..