Watchdog is enabled, but counter is not increasing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Watchdog is enabled, but counter is not increasing

709 Views
JuanGalvez
Contributor I

Hello, 

I am programming an S9KEAZ128 microcontroller, and I am running into a watchdog issue that I do not understand. 

At some point, I need to disable the watchdog to perform an operation, and then enable it again afterwards. The watchdog is correctly disabled. However, when I try to enable it again, the watchdog registers are correctly reconfigured as expected, but the watchdog timer is stuck at 0.

Here is the snippet of code that Disables the watchdog:

 

 

 

void Watchdog_disable(void)
{
    DisableInterrupts();

    WDOG->CNT = WATCHDOG_CNT_UNLOCK_SEQUENCE_1;
    WDOG->CNT = WATCHDOG_CNT_UNLOCK_SEQUENCE_2;

    WDOG->TOVAL = WDOG_TOVAL_TOVAL(WATCHDOG_TOVAL_VALUE);

    WDOG->CS2 = WDOG_CS2_CLK(WATCHDOG_CS2_CLK_1KHZ);

    WDOG->CS1 = WDOG_CS1_UPDATE_MASK |
                WDOG_CS1_WAIT_MASK   |
                WDOG_CS1_STOP_MASK;

    EnableInterrupts();
}

 

 

 

Here is the snippet of code that Enables the watchdog:

 

 

 

void Watchdog_enable(void)
{
    DisableInterrupts();

    WDOG->CNT = WATCHDOG_CNT_UNLOCK_SEQUENCE_1;
    WDOG->CNT = WATCHDOG_CNT_UNLOCK_SEQUENCE_2;

    WDOG->TOVAL = WDOG_TOVAL_TOVAL(WATCHDOG_TOVAL_VALUE);

    WDOG->CS2 = WDOG_CS2_CLK(WATCHDOG_CS2_CLK_1KHZ);

    WDOG->CS1 = WDOG_CS1_UPDATE_MASK |
                WDOG_CS1_WAIT_MASK   |
                WDOG_CS1_STOP_MASK   |
                WDOG_CS1_EN_MASK;

    EnableInterrupts();
}

 

 

 

I couldn't find anything on the reference manual that would explain this behavior. I wonder if this is a problem with the silicon, and if so, if there is a workaround. I would appreciate it if anyone could shed some light on this.

Thanks!

Labels (1)
0 Kudos
0 Replies