I'm working with the Kinetis K60 and I'm experiencing WDOG events happening and I cannot determine why its happening. I cannot believe they are happening due to the WDOG not being refreshed within it's timeout period.
I have the WDOG IRQ enabled and I'm taking a snap shot of the WDOG timeout periods and they appear to be well below the timeout limits.
I my case I've extended the timeout period to an extreme level to verify.
My timeout period is set to 10 seconds with a 1 second task refreshing the WDOG.
My IRQ posting is giving the following values:
WDOG_TMROUTH = 0x92
WDOG_TMROUTL = 0x7ce4
Here is my WDOG init method:
void wdtInit()
{
set_irq_priority (INT_Watchdog-16, 0);
enable_irq(INT_Watchdog-16) ;
wdtUnlock();
WDOG_TOVALH = 0x1c9c;
WDOG_TOVALL = 0x3800; /* 10 second period */
WDOG_WINH = 100;
WDOG_WINL = 100;
/* WDOG_STCTRLH: DISTESTWDOG=0,BYTESEL=0,TESTSEL=0,TESTWDOG=0,
* WAITEN=1,STOPEN=1,DBGEN=1,ALLOWUPDATE=1,WINEN=0
* ,IRQRSTEN=1,CLKSRC=0,WDOGEN=1 */
WDOG_STCTRLH = WDOG_STCTRLH_BYTESEL(0x00) |
WDOG_STCTRLH_WAITEN_MASK |
WDOG_STCTRLH_STOPEN_MASK |
WDOG_STCTRLH_DBGEN_MASK |
WDOG_STCTRLH_ALLOWUPDATE_MASK |
WDOG_STCTRLH_IRQRSTEN_MASK |
WDOG_STCTRLH_CLKSRC_MASK |
WDOG_STCTRLH_WDOGEN_MASK |
0x0100U;
}
After the WDOG event triggers, I do examine the reset registers:
RCM_SRS0 = 0x20
RCM_SRS1 = 0x0
and these indicate that the cause was a watchdog timeout, but with my TMROUTH and TMROUTL values do not indicate that refresh time has expired.
Can there be another reason or hidden setting that I'm missing?
Thanks
Terry
Solved! Go to Solution.
I believe the cause of the WDOG events turns out to be how I managed the WDOG_REFRESH operations.
I failed to read the fine print details that the two write operations must be completed within 20 bus cycles.
I have many IRQs running, which could easily exceed the 20 bus cycle delay.
By adding a Disable/Enable interrupts operation around my WDOG_REFRESH calls, the WDOG resets stopped happening.
I believe the cause of the WDOG events turns out to be how I managed the WDOG_REFRESH operations.
I failed to read the fine print details that the two write operations must be completed within 20 bus cycles.
I have many IRQs running, which could easily exceed the 20 bus cycle delay.
By adding a Disable/Enable interrupts operation around my WDOG_REFRESH calls, the WDOG resets stopped happening.