I used Watchdog timer in KW36 ble temp sens example. I can successfully use Watchdog if
#define cPWR_UsePowerDownMode 0
and clock source as either 'kCOP_LpoClock' or 'kCOP_McgIrClock'.
The COP reset MCU immediately after calling 'COP_Init()' function with source clock as either 'kCOP_OscErClock' or 'kCOP_BusClock' even if powerDownMode enabled.
The COP reset didn't occurred if
#define cPWR_UsePowerDownMode 1
with clock source as either 'kCOP_LpoClock' or 'kCOP_McgIrClock'.
The dafault settings is
void COP_GetDefaultConfig(cop_config_t *config)
{
assert(config);
config->enableWindowMode = false;
#if defined(FSL_FEATURE_COP_HAS_LONGTIME_MODE) && FSL_FEATURE_COP_HAS_LONGTIME_MODE
config->timeoutMode = kCOP_ShortTimeoutMode;
config->enableStop = true;
config->enableDebug = true;
#endif /* FSL_FEATURE_COP_HAS_LONGTIME_MODE */
config->clockSource = kCOP_BusClock;
config->timeoutCycles = kCOP_2Power10CyclesOr2Power18Cycles;
}
From the reference manual i understand i can use any of these clocks. I don't see the reason why i can't use source clock as either 'kCOP_OscErClock' or 'kCOP_BusClock'.
Also in reference manual :
Regardless of the clock selected, the COP is disabled when the chip enters a VLLSx
mode. Upon a reset that wakes the chip from the VLLSx mode, the COP is reinitialized
and enabled as for any reset.
Then why when module wakes for advertisement it wouldn't get reset?
Please anyone clarify these issues!
Best Regards,
Nidhin
Hello @nidhintomy,
As indicated in the Bluetooth Low Energy Demo Applications User Guide (inside KW36 SDK documentation folder > docs > wireless > Bluetooth), Chapter 5.14 Low Power Temperature Sensor and Collector, the application should switch between LLS and VLLS power modes by default. When sensor starts advertising, the device should enter into gAppDeepSleepMode_c deep-sleep mode (LLS or VLLS).
According to the KW36 Reference Manual, Chapter 4.4.11.2 COP watchdog operation and Chapter 8.5 Module Operation in Low Power Modes, COP should be disabled in VLLS mode and kept static in LLS mode.
Regards,
Eduardo.
Now i understand why COP Watchdog is not working in low power mode.
Could you please explain why COP Watchdog didn't work and immediately resets MCU when using different clock sources (kCOP_OscErClock, kCOP_BusClock )
Best Regards,
Nidhin
Hi,
Just to confirm, COP watchdog does not reset your device when cPWR_UsePowerDownMode is set to 1 and kCOP_LpoClock / kCOP_McgIrClock is selected as clock source, is this correct?
Please, consider that default Low Power modes in BLE Temperature Sensor example may disable some modules and clocks (for example, MCGIRCLK is disabled in LLS/VLLS mode). Also, if any value other than 0x55 or 0xAA is written to the SRVCOP register, or if a premature write is made to SRVCOP register, the chip may be reset immediately.
Please, take a look at the KW36 Reference Manual, section 4.4.11.2 COP watchdog operation and Chapter 6 Clock distribution for more information on this.
Regards,
Eduardo.
Just to confirm, COP watchdog does not reset your device when cPWR_UsePowerDownMode is set to 1 and kCOP_LpoClock / kCOP_McgIrClock is selected as clock source, is this correct?
Yes.
cPWR_UsePowerDownMode is set to 0.
Why COP module get resets in the 2nd scenario ?
Best Regards, Nidhin
Hi,
Could you please try selecting kCOP_LongTimeoutMode as timeout mode?
Regards,
Eduardo.
I Tried with kCOP_LongTimeoutMode . But it immediately reset the MCU.
If i am selecting kCOP_2Power10CyclesOr2Power18Cycles as timeoutCycles, then i got first 4 prints in the code given below.
for (uint32_t loopCount = 0U; loopCount < 10U; loopCount++)
{
COP_Refresh(SIM);
PRINTF("COP refresh %d time\r\n", loopCount + 1U);
}
Best Regards,
Nidhin
Hi,
Just to confirm this behavior, please try the driver_examples_cop example project from the SDK. You should notice that immediately after getting the COP default config, timeout mode is overwritten (from LongTimeoutMode to ShortTimeoutMode):
Please, skip/comment/disable this line and test the application selecting kCOP_OscErClock / kCOP_BusClock as clock source.
Regards,
Eduardo.
Please, skip this part of the code:
and try with the following configuration (in main function):
configCop.enableWindowMode = false;
configCop.timeoutMode = kCOP_LongTimeoutMode;
configCop.enableStop = false;
configCop.enableDebug = false;
configCop.clockSource = kCOP_BusClock;
configCop.timeoutCycles = kCOP_2Power10CyclesOr2Power18Cycles;
Flash the application and run it without debugging:
Regards,
Eduardo.
I followed your instructions.
My observations are:
1. It is only work with kCOP_2Power8CyclesOr2Power16Cycles and kCOP_2Power10CyclesOr2Power18Cycles.
2. Only works with kCOP_LongTimeoutMode.
3. If the program doesn't contain an while(1) loop or program exit the main() the COP reset mcu
4. If there is a while(1) loop or program never exit the main loop, it doesn't reset mcu
timeout for Lpo Clock is 2^18cycles or 4.37minutes. But when i tried bus clock with while(1) loop, even after 30 minutes timeout never occured.
I think the kCOP_OscErClock and kCOP_BusClock is not useful in COP watchdog.
Best Regards,
Nidhin
Hi,
Please, take a look at the KW36 Reference Manual, Section 4.4.11.2 COP watchdog operation. Table 4-24 summarizes the control functions for some SIM_COPC fields and the available configuration options for COP.
Regards.
I looked onto that table. But that table doesn't explain why those 2 clocks behavior like that. That also didn't explain why it is works in only long timeout (only 2^16 cycles and 2^18 cycles).
Best Regards
Nidhin