在线时间57 小时
UID3080775
注册时间2014-12-5
NXP金币0
该用户从未签到
中级会员
 
- 积分
- 357
- 最后登录
- 2015-12-1
|
大家好,我用MKL14芯片,参考坛子里KL25的低功耗的demo程序,将代码移植到MKL14上运行,由于我只需要进入VLPS模式,因此,
只需要测试VLPS模式。在测试时,发现不管进不进VLPS模式,我的功耗大致维持在10MA左右。跟没有进VLPS相比,功耗就相差1-2MA。
“在进VLPS模式之后,代码就停止执行,唤醒之后,代码继续执行”,另外,在调试运行的时候会有提示进入“low power stop"。我通过这个方法判断是否进入VLPS模式,当然,现在接了调试接口,会导致功耗到MA级别,拔掉调试接口,在VLPS模式下功耗为800薇安左右,跟VLPS的理论值还是相差很大。
各位大神,有没有什么思路提供参考下,谢谢!
进入vlps的代码如下所示:
enable_pta_interrupt();
uninit_user();
enable_porta_clock();
//clockMonitor(0);
/*Go to VLPS .Means: Any interrupt could wake up from this mode*/
enter_vlps();
/*just exit vlps mode can be run here*/
__init_user();
//clockMonitor(1);
disable_pta_interrupt();
void enter_vlps(void)
{
volatile unsigned int dummyread;
/* The PMPROT register may have already been written by init code
If so then this next write is not done since
PMPROT is write once after RESET
allows the MCU to enter the VLPR, VLPW, and VLPS modes.
If AVLP is already writen to 0
Stop is entered instead of VLPS*/
SMC_PMPROT = SMC_PMPROT_AVLP_MASK;
/* Set the STOPM field to 0b010 for VLPS mode */
SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK;
SMC_PMCTRL |= SMC_PMCTRL_STOPM(0x2);
/*wait for write to complete to SMC before stopping core */
dummyread = SMC_PMCTRL;
dummyread++;
/* Now execute the stop instruction to go into VLPS */
#ifdef CMSIS
/* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;
__wfi();
#else
stop();
#endif
}
void stop (void)
{
/* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;
asm("WFI");
}
|
|