AnsweredAssumed Answered

MCU(K10) reset although watchdog is feed

Question asked by Yanli Cheng on Dec 4, 2015
Latest reply on Dec 7, 2015 by Yanli Cheng

I develop a project on the K10 chip and use the software watchdog to detect 'system running', and then I met with the following strange issue:

I feed the wdog periodically, but the MCU still reset after running for a short time.

 

Watchdog is set as follows, can anyone check if it's right :

static void wdog_unlock(void)
{
DisableInterrupts;
WDOG_UNLOCK = 0xC520;
WDOG_UNLOCK = 0xD928;
EnableInterrupts;
}


void wdog_init(void)
{
wdog_unlock();
WDOG_PRESC = 0x0400;
WDOG_TOVALH = 0x01c9; /*timer out is 3s*/
WDOG_TOVALL = 0xc380;
WDOG_STCTRLH = 0x01D3;
}


void wdog_feed(void)
{
wdog_unlock();

WDOG_PRESC = 0x0400;
WDOG_REFRESH = 0xA602;
WDOG_REFRESH = 0xB480;
}

 

The place I feed the watchdog is:

void pvPollingThread()

{

            if( eMBPoll(  ) != MB_ENOERR )       

                 break;

 

            wdog_feed();

}

 

It's a polling thread, and every 2 seconds,  the MCU will receive a message, then go handle the event (cost about 100 milli seconds). Otherwise, it'll go into the next loop.

I use oscillograph to detect the wdog_feed frequency. When no events need to be handled,  the wdog is feed after several microseconds; when event occurs, the wdog is feed after several milli-seconds. Thus, wdog is not feed at a fixed frequency( first short interval ,then long interval, but all within 1s, less than the required 3s ).  Does it matter?

 

When no events need to be handled, the wdog is always feed at a high frequency, the MCU won't reset.

Outcomes