I am working on watchdog timer of MKL26Z256VLH4, I have flashed cop sample application and it worked perfectly fine. but when I included cop function in my current program, COP is refreshing but it is not resetting after the loopcount is finished.
/* Check if WDOG reset occurred */
if (RCM_GetPreviousResetSources(RCM) & kRCM_SourceWdog)
{
PRINTF("Reset due to COP timeout\r\n");
COP_Disable(SIM);
PRINTF("COP example ends!\r\n");
}
else
{
/* If WDOG reset is not occurred, enables COP */
PRINTF("\r\nCOP example start!\r\n");
COP_Init(SIM, &configCop);
/* Refresh COP 10 times and then wait for timeout reset */
for (uint32_t loopCount = 0U; loopCount < 10U; loopCount++)
{
COP_Refresh(SIM);
PRINTF("COP refresh %d time\r\n", loopCount + 1U);
}
PRINTF("COP will timeout and chip will be reset\r\n");
}
while (1)
{}
Hi omkar,
If you are using SDK example, then please notice the definition of DISABLE_WDOG.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Check the datasheet for timing limits on COP.
Usually COP can only be disabled/enabled within so many cycles of a physical reset.
It may also be a write once thing, make sure that some bootloader is not disabling it.
Move the COP code as close to the start of main() as your hardware setup will allow.
Ideally COP would be first, however sometime I/O needs dealt with faster.
At a minimum move the COP instructions before the printf()s, those take a lot of cycles.