K60 with MQX 4.2: cannot enter STOP mode (LLS)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

K60 with MQX 4.2: cannot enter STOP mode (LLS)

跳至解决方案
1,493 次查看
louef
Contributor II

Hello,

I am working on a K60 custom board with MQX 4.2 and I am having issues putting the processor to STOP mode (LLS). It seems the WFI instruction has no effect. _lpm_set_operation_mode(LPM_OPERATION_MODE_STOP) is called from PEE at 96 Mhz. Clock config was done using Processor Expert, the custom board has a 8 MHZ resonator. Before WFI is executed, here are the registers:

SIM_SCGC4 = 0xF0100070 -> LLWU is set

LLWU_ME = 0x01 -> WUME0 is selected for wakeup source

MCG_C6 = 0x40 -> clock monitor disabled

MC_PMPROT = 0x2A -> LLS is allowed

MC_PMCTRL = 0x8B -> STOPM to Low-Leakage Stop (LLS), RUNM=00

SCB_SCR = 0x04 -> SLEEPDEEP bit is set

After WFI instruction:

LLWU_F3 = 0x00 - > Module 0 input was not a wakeup source

SMC_PMCTRL = 0x8B -> STOPA is set

I also tried the Lowpower mqx example without success.

Any help would be appreciated, Thank You.

1 解答
1,183 次查看
louef
Contributor II

Thank you David but I found the problem. In lpm_smc.c, there is a SPI workaround(ENGR00178898) where SPI clocks are disabled before calling WFI. This fix is incomplete as it only takes care of SPI0 and SPI1. On my custom board, SPI2 is used so the following lines must be added.

/*before  _ASM_SLEEP(NULL)*/

#ifdef SIM_SCGC3_SPI2_MASK

        SIM_SCGC3 &= ~SIM_SCGC3_SPI2_MASK;

#endif

/*after  _ASM_SLEEP(NULL)*/

#ifdef SIM_SCGC3_SPI2_MASK

        SIM_SCGC3 |= SIM_SCGC3_SPI2_MASK;

#endif

在原帖中查看解决方案

3 回复数
1,184 次查看
louef
Contributor II

Thank you David but I found the problem. In lpm_smc.c, there is a SPI workaround(ENGR00178898) where SPI clocks are disabled before calling WFI. This fix is incomplete as it only takes care of SPI0 and SPI1. On my custom board, SPI2 is used so the following lines must be added.

/*before  _ASM_SLEEP(NULL)*/

#ifdef SIM_SCGC3_SPI2_MASK

        SIM_SCGC3 &= ~SIM_SCGC3_SPI2_MASK;

#endif

/*after  _ASM_SLEEP(NULL)*/

#ifdef SIM_SCGC3_SPI2_MASK

        SIM_SCGC3 |= SIM_SCGC3_SPI2_MASK;

#endif

1,183 次查看
matlock
Contributor II

Be careful with this peripheral clock clearing/setting as it does not work for SLEEP mode since the core will execute the event that takes the core out of SLEEP which can attempt to use the SPI[0-2] causing Hardfaults.

1,183 次查看
DavidS
NXP Employee
NXP Employee

Hi Louise-Philippe,

If you have problem with Lowpower example in MQX my guess is you have the debugger/IDE being used during test.  If debugger interface active the device will not go into low power mode.  You need to disconnect the debugger and let application run independently.

If your debugger interface is not being used maybe there is outstanding ISR request for some reason???

Regards,

David

0 项奖励
回复