在线时间43 小时
UID38803
注册时间2008-3-29
NXP金币0
TA的每日心情 | 开心 2019-7-2 13:42 |
---|
签到天数: 31 天 连续签到: 1 天 [LV.5]常住居民I
高级会员

- 积分
- 576
- 最后登录
- 2020-4-7
|
本帖最后由 bjx1234 于 2016-10-15 16:44 编辑
我在自行设计的PCB上,使用了KL26做低功耗实验(低功耗方面与KL25相同),使用外部32.768KHz做为时钟源,内部时钟24MHz.供电电源上串入万用表来测电流。//mcg_clk_hz = 32768 * 732; // 24Mhz
在没有加入低功耗测试代码之前运行正常。
参考了官方例程low_power_demo.,我的按键与指示定义与FRDM-KL25Z开发板不一样。调试时没有使用串口。使用J-LINK仿真器调试。
int main (void)
{
.........
/*Enable all operation modes because this is a write once register*/
SMC_PMPROT = SMC_PMPROT_AVLLS_MASK |
SMC_PMPROT_ALLS_MASK |
SMC_PMPROT_AVLP_MASK;
/*PTC3(SW3) is configured to wake up MCU from VLLSx and LLS modes, Interrup is ne*/
LLWU_Init();
/*Configure Tower hardware for the application*/
Port_Init(IO_NMI_DEF);
SW_LED_Init();
EnableInterrupts;
/*Start test*/
LowPowerModes_test();
..................
}
void LowPowerModes_test(void)
{
.......
while(1)
{
while (test_num > 22 | test_num < 0){
LED0_ON;
LED1_ON;
LED2_ON;
#ifndef FREEDOM
LED3_ON;
#endif
if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 4){
printf(" in VLPR Mode ! ");
} else if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 1){
printf(" in Run Mode ! ");
}
op_mode = what_mcg_mode();
......
printf("\n\r > ");
test_val = uart0_getchar(UART0_BASE_PTR);
uart0_putchar(UART0_BASE_PTR,test_val);
printf("\n\r");
....
switch(test_num){
.....
}
}
op_mode = what_mcg_mode(); //返回值是4,也就是FEE
我让test_num=0
程序运行到stop();之后J-LINK仿真中断。检测电流发现,进入低功耗之前和之后没有变化。test_num=1,2时,现象也一样。
请问这是怎么回事?
最佳答案
本帖最后由 小恩GG 于 2016-10-17 10:55 编辑
SMC_PMPROT这个寄存器是复位后只写一次的。
你看看你启动的配置里面,有没有对SMC寄存器操作过,也就是一开始是配置为不使能VLLSx的?
如果之前配置过不使能,后续再 ...
|
-
|