[技术问题解答] KL25Z128 低功耗模式问题(已解决)

[复制链接]
3293|15
 楼主| jiahongjian 发表于 2014-5-4 13:50 | 显示全部楼层 |阅读模式
本帖最后由 FSL_TICS_A 于 2014-6-3 15:43 编辑

LLWU引脚   能设为wakeup唤醒的同时在设置成普通输入口吗?比如 我有一按键接在LLWU_P8(PTC4)上,平时拿它做普通按键,进入睡眠模式时按这个按键唤醒
FSL_TICS_Jeremy 发表于 2014-5-4 15:34 | 显示全部楼层
你好,楼主!
你的想法是可以的。
如有疑问,再交流!
 楼主| jiahongjian 发表于 2014-5-4 16:03 | 显示全部楼层
如何实现,我用PE配置时报错,我先定义了PTC4为输入,在配置LLWU_P8时就会报错
 楼主| jiahongjian 发表于 2014-5-4 16:35 | 显示全部楼层
先定义为输入,后面就不能定义为LLWU了

codewarror报错

codewarror报错
FSL_TICS_Jeremy 发表于 2014-5-4 17:24 | 显示全部楼层
jiahongjian 发表于 2014-5-4 16:35
先定义为输入,后面就不能定义为LLWU了

谢谢你的回复,sorry.我的回答有错误。
再经查阅参考手册后,我发现LLWU只有LLS,VLLSx模式是工作的,正常的RUN模式应该是Static状态。
1.jpg
 楼主| jiahongjian 发表于 2014-5-4 21:53 | 显示全部楼层
那这个按键就不能有2个功能吗? 我不可能专门去做个按键唤醒啊
FSL_TICS_Jeremy 发表于 2014-5-5 13:51 | 显示全部楼层
jiahongjian 发表于 2014-5-4 21:53
那这个按键就不能有2个功能吗? 我不可能专门去做个按键唤醒啊

如果你把GPIO设置为输入,采用查询的方式探测引脚的电平高低应该是可以的。
而PE配置出错的出现,可能软件默认两者不可同时配置吧。
 楼主| jiahongjian 发表于 2014-5-5 14:34 | 显示全部楼层
具体该怎么实现了
 楼主| jiahongjian 发表于 2014-5-6 12:11 | 显示全部楼层
那大神帮帮忙哇。。。。
 楼主| jiahongjian 发表于 2014-5-24 13:56 | 显示全部楼层
本帖最后由 jiahongjian 于 2014-5-24 14:55 编辑

有人能帮忙解答一下吗? 例如 PTC4作为TPM0_C3V 外部信号 做计数用,如何再将PTC4作为LLWU功能唤醒MCU
dong_abc 发表于 2014-5-25 01:47 | 显示全部楼层
本帖最后由 dong_abc 于 2014-5-25 01:49 编辑

我做过这个功能。 PTC4和 llwu 都设置成输入中断。PTC4下降沿唤醒单片机,同时进入llwu中断。

  1. void Config_pushbutton(void)
  2. {
  3.     FGPIOC_PDDR &= ~(0x10);  // Configure as input
  4.    
  5.     PORTC_PCR4 = (PORT_PCR_MUX(1)
  6.                   | PORT_PCR_PE_MASK
  7.                   | PORT_PCR_PS_MASK
  8.                   | PORT_PCR_IRQC(0xA));
  9.    
  10.     /* Set the ICPR and ISER registers accordingly */
  11.     NVIC_ICPR |= (uint32)(1 << ((INT_PORTC_PORTD-16)%32));
  12.     NVIC_ISER |= (uint32)(1 << ((INT_PORTC_PORTD-16)%32));
  13.    
  14.     set_irq_priority(INT_PORTC_PORTD-16, 3);
  15. }



  16. PE_ISR(Pushbutton_Interrupt)
  17. {   
  18.    
  19.    if(MCM_CPO & MCM_CPO_CPOACK_MASK){
  20.       MCM_CPO &= ~MCM_CPO_CPOREQ_MASK;
  21.       while (MCM_CPO & MCM_CPO_CPOACK_MASK);                                    
  22.     }
  23.     if ((PORTC_PCR4 & PORT_PCR_ISF_MASK) == PORT_PCR_ISF_MASK)
  24.       
  25.     {
  26.         PORTC_PCR4 |= PORT_PCR_ISF_MASK;
  27.         
  28.     }
  29. }

  1. void low_power_init(void)
  2. {
  3. /*PTC4is configured to wake up MCU from VLLSx and LLS modes, Interrup is ne*/
  4. enable_irq(INT_LLW-16);
  5.         set_irq_priority(INT_LLW-16, 1);
  6.         
  7.         llwu_configure(0x0100/*PTC4*/, LLWU_PIN_FALLING, 0x1);
  8.         
  9.         PORTC_PCR4 =  PORT_PCR_PS_MASK |
  10.         PORT_PCR_PE_MASK |
  11.         PORT_PCR_PFE_MASK |
  12.         PORT_PCR_IRQC(10) | /* IRQ Falling edge */
  13.         PORT_PCR_MUX(1);
  14.         
  15. enable_irq(31); //Enable GPIO interrupts on PORTC
  16. }

  1. PE_ISR(llw_isr){
  2.   
  3.    if (LLWU_F2 & LLWU_F2_WUF8_MASK) {
  4.        LLWU_F2 |= LLWU_F2_WUF8_MASK;   // write one to clear the flag
  5.       
  6.       if(mpu_time_mode) {mpu_25ms_cnt++;}
  7.       else mpu_25ms_cnt = 0;
  8.       
  9.       if(sedent_monit_mode) sedent_time_cnt++;
  10.       else sedent_time_cnt=0;
  11.                   
  12.    }   
  13.    //***********************************************************************
  14.    // * Note: This ISR does not write to the LLWU_F3 register because these
  15.    // * are peripheral module wakeups.  The flags contained in the LLWU_F3
  16.    // * register should be cleared through the associated module interrupt
  17.    // * and not through the LLWU_F3 per the Kinetis L Family Reference
  18.    // * Manual (LLWU Chapter)
  19.    // *********************************************************************
  20.   if (LLWU_F3 & LLWU_F3_MWUF0_MASK) {
  21.          SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK;
  22.          LPTMR0_CSR |=  LPTMR_CSR_TCF_MASK;   // write 1 to TCF to clear the LPT timer compare flag
  23.          LPTMR0_CSR = ( LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK  );
  24.    }
  25.    if(LLWU_FILT1 & LLWU_FILT1_FILTF_MASK){
  26.    
  27.     LLWU_FILT1 |= LLWU_FILT1_FILTF_MASK;
  28.    }
  29.    if(LLWU_FILT2 & LLWU_FILT2_FILTF_MASK){
  30.    
  31.     LLWU_FILT2 |= LLWU_FILT2_FILTF_MASK;
  32.    }
  33.    NVIC_ICPR |= 1 << (LLWU_irq_no%32);
  34. }

dong_abc 发表于 2014-5-25 01:54 | 显示全部楼层
楼主在用KL25/26这颗芯片吗?

我在这里混了个把月,纵观21ic,貌视只有我一个人在用这个芯片。
 楼主| jiahongjian 发表于 2014-5-26 10:35 | 显示全部楼层
dong_abc 发表于 2014-5-25 01:54
楼主在用KL25/26这颗芯片吗?

我在这里混了个把月,纵观21ic,貌视只有我一个人在用这个芯片。 ...

我用的KL34/36 你也在用?
dong_abc 发表于 2014-5-26 12:40 | 显示全部楼层
jiahongjian 发表于 2014-5-26 10:35
我用的KL34/36 你也在用?

我在用KL26,遇到一大堆问题。
FSL_TICS_A 发表于 2014-5-26 12:54 | 显示全部楼层
dong_abc 发表于 2014-5-26 12:40
我在用KL26,遇到一大堆问题。

请问有什么问题?
 楼主| jiahongjian 发表于 2014-5-26 15:26 | 显示全部楼层
本帖最后由 jiahongjian 于 2014-5-26 15:30 编辑
FSL_TICS_A 发表于 2014-5-26 12:54
请问有什么问题?

我的低功耗问题已经解决了
你遇到了什么问题?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

24

主题

140

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部