KW36 Watchdog having problem in Low Power Mode and Different Source Clocks

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KW36 Watchdog having problem in Low Power Mode and Different Source Clocks

3,390 Views
nidhintomy
Contributor IV

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

Tags (2)
0 Kudos
Reply
12 Replies

3,373 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

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.

0 Kudos
Reply

3,362 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

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

0 Kudos
Reply

3,357 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

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.

0 Kudos
Reply

3,351 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

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.

  • If kCOP_LpoClock / kCOP_McgIrClock is selected as clock source, COP works fine.
  • If kCOP_OscErClock/ kCOP_BusClock is selected as clock source, COP reset MCU immediately after calling 'COP_Init()' function(Didn't call refresh function).

Why COP module get resets in  the 2nd scenario ?

Best Regards, Nidhin                                                                                                                                                                       

 

0 Kudos
Reply

3,320 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

Could you please try selecting kCOP_LongTimeoutMode as timeout mode?

Regards,
Eduardo.

0 Kudos
Reply

3,315 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

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

0 Kudos
Reply

3,303 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

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):

EduardoZamora_0-1667320916168.png

Please, skip/comment/disable this line and test the application selecting kCOP_OscErClock / kCOP_BusClock as clock source.

Regards,
Eduardo.

0 Kudos
Reply

3,297 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

I already tried that. But not working.

 

Best Regards,

Nidhin

0 Kudos
Reply

3,292 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Please, skip this part of the code:

EduardoZamora_1-1667406124872.png

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:

EduardoZamora_0-1667405899973.png

Regards,
Eduardo.

0 Kudos
Reply

3,288 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

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

0 Kudos
Reply

3,280 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

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.

0 Kudos
Reply

3,273 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

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

0 Kudos
Reply