在线时间101 小时
UID288887
注册时间2011-5-8
NXP金币0
该用户从未签到
中级会员
 
- 积分
- 491
- 最后登录
- 1970-1-1
|
今天测试KL02低功耗。关闭所有外设,进入vlps模式,测试功耗2微安。当初始化外部中断后,进入vlps模式功耗在60微安。当初始化lptmr后,功耗达到600微安。使用外部中断是因为产品中的传感器正好有个中断信号,使用lptmr,计时多久发一次。产品整体功耗算下来,还是偏大。我把初始化的代码贴出来,大家看看是不是配置问题啊。
void PTA7_Iterrupt_Init() //pTA7
{
PORTA_ISFR = PORT_ISFR_ISF(0x0080); /* Clear interrupt status flag */
PORTA_PCR7 = PORT_PCR_MUX(1); //
PORTA_PCR7 |= PORT_PCR_IRQC(0x08); //
set_irq_priority((INT_PORTA-16), 1);
enable_irq(INT_PORTA - 16); //enable interrupt 30
}
void lptmr_init(int count, int clock_source)
{
SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK; //¿ªÆôµÍ¹¦ºÄ¶¨Ê±Æ÷·ÃÎÊ¿ØÖÆ
LPTMR0_CSR &= ~LPTMR_CSR_TEN_MASK; // disable LPTMR
//LPTMR0_CSR |= LPTMR_CSR_TEN_MASK;
// select LPO for RTC and LPTMR
LPTMR0_PSR = ( LPTMR_PSR_PRESCALE(0) // 0000 is div 2
| LPTMR_PSR_PBYP_MASK // clock feeds directly to LPT Ô¤·ÖƵÆ÷/¹ÊÕϹýÂËÅÔ·
| LPTMR_PSR_PCS(clock_source)) ; // use the choice of clock
LPTMR0_CMR = LPTMR_CMR_COMPARE(count); //Set compare value
LPTMR0_CNR = 0;
// clear flag
LPTMR0_CSR |= LPTMR_CSR_TCF_MASK;
LPTMR0_CSR =( LPTMR_CSR_TCF_MASK // Clear any pending interrupt
| LPTMR_CSR_TIE_MASK // LPT interrupt enabled
);
// LPTMR0_CNR = 0;
LPTMR0_CSR |= LPTMR_CSR_TEN_MASK; //Turn on LPT and start counting
set_irq_priority((INT_LPTimer-16), 3);
enable_irq(INT_LPTimer - 16);
}
|
|