下面是出现无法睡眠时,打印出来的寄存器的值,目前无法判断哪里出问题
特别注意的是,以下标记为0
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
能否说明一下您使用的程序?另外建议您在下面的勘误表内搜索 LPMx.5
程序其实很简单的,
if (SYSRSTIV == SYSRSTIV_LPM5WU) { //reset from LPM35 clockInit(); rtcReStart(); __enable_interrupt(); taskRun(); enterLPM35(); } else { //POR init clockInit(); rtcInit(); enterLPM35(); } }
static void enterLPM35(void) { PMMCTL0_H = PMMPW_H; PMMCTL0_L &= ~SVSLE; PMMCTL0_L |= PMMREGOFF; PMMCTL0_H = 0; __enable_interrupt(); __bis_SR_register(LPM3_bits + GIE); // LPM3 + Enable interrupt }
如果不能进入睡眠,程序则跑到死循环,目前就是有时会进入死循环,这个位置不应该出现的,正常情况下,__bis_SR_register(LPM3_bits + GIE)后就会切断CPU Core电源,不会继续跑的
麻烦帮我问海外原厂,目前海外论坛发不了帖子,谢谢了,目前从勘误表看调试模式会导致进入不了睡眠,也尝试过将TEST脚用4.7K下拉电阻,避免TEST被拉高,PJ0-PJ3这4个IO都设置输出但是还是会出现不能进入睡眠
请您跟踪下面帖子的回复
https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1033928/msp430fr5738-can-not-enter-lpm3-5-sometimes
不是版本问题,是LPM3.5 不建议进入debug 调试, 建议让芯片下载好程序后上电自由跑,然后使用GPIO 指示运行状态。 其它逻辑部分可以使用LPM3 在debug 模式下调试。
死循环我有亮灯,还有串口消息打印,那个地方不可能跑进去的
if (SYSRSTIV == SYSRSTIV_LPM5WU) { //reset from LPM35 clockInit(); rtcReStart(); __enable_interrupt(); TaskRun(); //printfReg(); enterLPM35(); } else { //POR init clockInit(); rtcInit(); //printfReg(); enterLPM35(); } //should never run to here! while (1) { Delay_s(20); dbgLED_blink(1); uart_init(); Delay_ms(2); printfReg(); }
是的,这个启动代码都是从TI资源库里面拿出来用的,没改过
void main(void) { uint8_t wksrc = WKSRC_RTC; WDTCTL = WDTPW + WDTHOLD; // Stop WDT //Unlock the GPIO pins. /* * By default, the pins are unlocked unless waking * up from an LPMx.5 state in which case all GPIO * are previously locked. * */ PM5CTL0 &= ~LOCKLPM5; if (SYSRSTIV == SYSRSTIV_LPM5WU) { //reset from LPM35 clockInit(); rtcReStart(); __enable_interrupt(); taskRun(); enterLPM35(); } else { //POR init clockInit(); rtcInit(); enterLPM35(); } }
建议在enterLPM35();之前再清除一遍LOCKLPM5。
建议使用简易程序进行测试如有问题复现请将测试程序发我分析,谢谢
我这边再帮你看看有没有其它影响因素