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
Hi,
Do you pay attention to the fact that the SIM_COPC register can be written only once after Reset?
Hope it can help you
BR
XiangJun Rong
Yes, i found that after i sent this question.
if this is the case, then how could I clear the WDOG flag on both RCM_SRS0 and RCM_SSRS0 registers?
As you may see my code, I use the RCM_ClearStickyResetSources(RCM, kRCM_SourceWdog); to clear the flags, but the WDOG show up the next loop. Plus the RCM_SRS0 is read only, is it clear only at POR?
Please kindly advise. Thank you.