Skip to main content
Andres Cao
Associate III
August 29, 2017
Question

Debugging resets - Watchdog resetting even after clearing?

  • August 29, 2017
  • 8 replies
  • 2255 views
Posted on August 29, 2017 at 17:48

Hi!

I have some very sporadic resets that are proving troublesome to debug. I'm using an STM32L083

Based on the RCC_CSR there's an IWDG reset. The IWDG is definitely enabled (total time of 28s) and being cleared often.

Do you know of any reasons I could get an IWDG reset, besides a timeout? The RTC is waking the device from sleep up every 10 seconds and clearing the IWDG.

I thought that a fault handler (Hal Error_Handler or HardFault_Handler) could be triggered, and enabled console messages in case it ends up there. I never read any of those messages.

Is there any other default infinite loop? Any input ideas are welcomed.

Thanks!

    This topic has been closed for replies.

    8 replies

    waclawek.jan
    Super User
    August 29, 2017
    Posted on August 29, 2017 at 18:07

    The IWDG is definitely enabled (total time of 28s) and being cleared often.

    Do you also change the IWDG period?

    JW

    Andres Cao
    Associate III
    August 30, 2017
    Posted on August 30, 2017 at 13:17

    Hi Jan,

    No, the IWDG period is set at the beginning and never changed again.

    Jaroslav BECKA
    ST Employee
    August 29, 2017
    Posted on August 29, 2017 at 18:27

    Hello Andres,

    make sure that the window option is not enabled. Otherwise if refresh is done too early, the IWDG reset will be triggered.

    Another reason could be the infinite loop as you mentioned.

    The hard fault exception can be caused by many things.

    To find out whether this exception is invoked or not, you can for instance toggle with a GPIO in the infinite loop and check it using oscilloscope.

    It is also possible to enable debug in low-power modes. Using breakpoints you should be able to find out if either Error_Handler is called or hard fault exception triggered.

    Andres Cao
    Associate III
    August 30, 2017
    Posted on August 30, 2017 at 13:21

    Hi Jaroslav,

    I will double check for that, though I don't think so. I will also make a simple 

    while(1)

       Clear_Watchdog();

    To double check if too fast refreshing can be a cause, just to discard it. 

    Do you think putting UART commands on the hardfault handler is a bad idea compared to pin trigger? Because right now I'm just logging the serial port and checking if a reset occured every once in a while. I do this because it's non periodic, it can happen every couple of hours, or sometimes it doesn't happen in a full day.

    I'm not using the debugger but will also take a look into it for more possibilities.