I am currently using the FSL to implement the watchdog timer on an MK64FX512VLQ12. I am setting the timeout to 5 seconds. I then use a test function that waits 10 seconds without refreshing the watchdog to cause it to trip. Most of the time the watchdog trips at 5 seconds as expected but sometimes it trips at times between 2 and 4 seconds. Could someone take a look at this and suggest what I might be doing wrong?
void Watchdog_Initialize( void )
{
wdog_config_t config;
WDOG_GetDefaultConfig( & config );
// Enable Watchdog timer with a timeout of 5 seconds.
config.timeoutValue = 5000;
config.enableWdog = true;
WDOG_Init( WDOG, & config );
}
void Watchdog_Reset( void )
{
WDOG_Refresh( WDOG );
}
void Watchdog_Test( int nModulo )
{
Watchdog_Reset();
Command_Print( "Triggering watchdog timer reset by waiting for 10 seconds" );
Timer_BeginCountdown( CountdownTimerMain, 10000 );
while( ! Timer_IsCountdownExpired( CountdownTimerMain ) )
{
asm( "NOP" );
}
Command_Print( "Failed to trigger watchdog timer reset after 10 seconds" );
}