在线时间11 小时
UID408428
注册时间2012-12-23
NXP金币0
该用户从未签到
注册会员

- 积分
- 115
- 最后登录
- 2019-7-23
|
本帖最后由 FSL_TICS_ZJJ 于 2014-12-4 14:02 编辑
各位,我在VLPS模式下使用LPTMR,当我选LPTMR_USE_LPOCLK作为LPTMR计数器的时钟源时(预分频器旁路),LPTMR正常工作;当我选LPTMR_USE_OSCERCLK作为LPTMR的时钟源时(预分频器没有旁路),LPTMR不工作。
我想问,在VLPS低功耗模式下,LPTMR的预分频器不工作吗?
求大神解答。
LPTMR初始化代码如下:
- void lptmr_init(int count, int clock_source)
- {
- SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK;
- /* disable module first */
- LPTMR0->CSR = 0x00;
- LPTMR0->PSR = 0x00;
- LPTMR0->CMR = 0x00;
-
- LPTMR0_PSR = ( LPTMR_PSR_PRESCALE(0X07) // 0000 is div 2
- //| LPTMR_PSR_PBYP_MASK // LPO feeds directly to LPT
- | LPTMR_PSR_PCS(clock_source)) ; // use the choice of clock
- LPTMR0_CMR = LPTMR_CMR_COMPARE(count); //Set compare value
- LPTMR0_CSR =( LPTMR_CSR_TCF_MASK // Clear any pending interrupt
- | LPTMR_CSR_TIE_MASK // LPT interrupt enabled
- | LPTMR_CSR_TPS(0) //TMR pin select
- |!LPTMR_CSR_TPP_MASK //TMR Pin polarity
- |!LPTMR_CSR_TFC_MASK // Timer Free running counter is reset whenever TMR counter equals compare
- |!LPTMR_CSR_TMS_MASK //LPTMR0 as Timer
- );
- LPTMR0_CSR |= LPTMR_CSR_TEN_MASK; //Turn on LPT and start counting
- NVIC_EnableIRQ(LPTimer_IRQn);
- NVIC_SetPriority(LPTimer_IRQn,1);
- }
复制代码
|
|