Quantcast
Channel: MSP 低功耗微控制器论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 3634

MSP430FR6972串口在LPM3模式下接收数据异常

$
0
0

芯片:MSP430FR6972

问题描述:

串口配置:波特率115200,时钟源SMCLK=1M,在低功耗模式LPM3下接收到的数据是错的。在LPM1模式正常或者把波特率设置为9600也是正常的

在论坛找到一个和我同样问题的提问,但是解答不够充分。

https://e2echina.ti.com/question_answer/microcontrollers/msp430/f/55/p/100453/538570#538570

程序代码:

int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
PM5CTL0 &= ~LOCKLPM5;
MSP_Clock_Config();
MSP_USCI1_Init();
Init_Var();
_EINT();
while(1)
{
if(USCI1_RTx->Rxflag == 1)
{
USCI1_Send_nByte(USCI1_RTx->Rxbuf, USCI1_RTx->Rxlen);
USCI1_RTx->Rxflag=0;
USCI1_RTx->Rxlen=0;
}
LPM3;
}
}

串口配置:

void MSP_USCI1_Init(void)
{
/* Configure UART pins */
P3SEL0 |= BIT4 | BIT5;
P3SEL1 &= ~(BIT4 | BIT5);

UCA1CTLW0 = UCSWRST;
UCA1CTLW0 |= UCSSEL__SMCLK;
/* 115200 */
// UCA1BR0 = 8;
// UCA1MCTLW = 0xD600;
// UCA1BR1 = 0;
/* 9600 */
UCA1BR0 = 6;
UCA1BR1 = 0;
UCA1MCTLW |= UCOS16 | UCBRF_8 | 0x2000;

UCA1CTL1 &= ~UCSWRST;
UCA1IE |= UCRXIE;
}


Viewing all articles
Browse latest Browse all 3634

Trending Articles