Hi, I tried to follow the cop example project to use the watchdog, but I noticed the COP_Disable(SIM); works fine in the example project. So now, I would like to flash my LED after watchdog timeout reset, then clear the watchdog timeout flag, then restart the watchdog, it didn't work on my project unfortunately. I found that the COP_Disable(SIM); won't disable the COP, plus the SIM_COPC_COPT did not change, this bit won't change even i write into the register directly.
All I want is to turn my LEDs indication to represent the different stage of watchdog process as follow:
Normal running: Red ON, Green OFF
After watchdog reset: Both Red and Green ON
watchdog flags are cleared and COP restarted: Red OFF, Green ON
Please see my code below and comments. Thank you.
if (RCM_GetPreviousResetSources(RCM) & kRCM_SourceWdog)
{
COP_Disable(SIM);
LED_RED_ON();
LED_GREEN_ON();
RCM_ClearStickyResetSources(RCM, kRCM_SourceWdog);
COP_Init(SIM, &configCop);
LED_RED_OFF();
LED_GREEN_ON();
}
else
{
// If WDOG reset is not occurred, enables COP
COP_Refresh(SIM);
LED_RED_ON();
LED_GREEN_OFF();
}
Regards,
Gilbert