Hi deepak,
I suppose that your command CPMUCOP=0; should disable watchdog. Right?
Unfortunately, this is possible only in special single chip mode. The CPMUCOP register could be written just once in normal mode.
Also modifying CSAD, COPOSCSEL0 and COPOSCSEL1 bits in CPMUCLKS register is possible in normal mode only until we write into the CPMUCOP register.
So, watchdog should be initialized just once in code. Disabling COP doesn’t have sense. If you do not want periodically wake-up just for trigger watchdog, please configure watchdog clock source to some clock which will be disabled during stop mode.
The command “setReg8(CPMURFLG, 0x00U); /* Clear COP reset flag */” will not clear COP reset flag.
There should be: setReg8(CPMURFLG, 0x08U); /* Clear COP reset flag */
I would like to recommend disabling edge interrupt inside SCI interrupt routine instead in main().
Note (slightly out of this topic): Be aware, when you combine API and LIN wake-up. When the voltage level on LIN pin is currently low and MCU wakeups by API, LIN PHY will wakeups also and it transfer LIN pin status to SCI module. Therefore, SCI edge interrupt will be triggered also, despite on fact that LIN wake-up signal was not sent yet or duration of LIN wake-up signal is shorter than tWUFR. See chapter 17.4.3.4 Standby Mode with Wake-Up Feature in RM.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------