msp430 f5529串口通信问题

msp430f5529在修改主时钟频率为40mhz后就串口接受不到数据,注释掉修改语句后数据会出现问题输入数据的是1,debug测试出来的是50多

void USART0_Config(void)
{
//串口初始化
P3SEL |= BIT3+BIT4 ; // P5.6,7 = USCI_A1 TXD/RXD
UCA0CTL1 |= UCSWRST; // Put state machine in reset
UCA0CTL1 |= UCSSEL_1; // ACLK
UCA0BR0 = 0x03; //0x03; // 32768Hz 9600 波特率为9600
UCA0BR1 = 0x00; //0x00; // 32768Hz 9600
UCA0MCTL |= UCBRS_3 + UCBRF_0 ; // Modulation UCBRSx=1, UCBRFx=0
UCA0CTL1 &= ~UCSWRST; // Initialize USCI state machine
UCA0IE |= UCRXIE; // Enable USCI_A1 RX interrupt 使能中断

 _EINT();

}

void USART1_Config(void)
{

//串口初始化
 P4SEL    |=  BIT4+BIT5 ;                        // P5.6,7 = USCI_A1 TXD/RXD
 UCA1CTL1 |=  UCSWRST;                      // **Put state machine in reset**
 UCA1CTL1 |=  UCSSEL_1;                     // ACLK
 UCA1BR0   =  0x03;                         // 32768Hz 9600 波特率为9600
 UCA1BR1   =  0x00;                             // 32768Hz 9600
 UCA1MCTL |=  UCBRS_3 + UCBRF_0;           // Modulation UCBRSx=1, UCBRFx=0
 UCA1CTL1 &= ~UCSWRST;                   // **Initialize USCI state machine**
 UCA1IE   |=  UCRXIE;                       // Enable USCI_A1 RX interrupt 使能中断             //
 _EINT();

}

void send0_buf(unsigned char *ptr) //发送字符串
{
while(*ptr != '\0')
{
while(!(UCA0IFG & UCTXIFG));
UCA0TXBUF = *ptr;
ptr++;
delay(10);
}
}
void send1_buf(unsigned char *ptr) //发送字符串
{
while(*ptr != '\0')
{
while(!(UCA1IFG & UCTXIFG));
UCA1TXBUF = *ptr;
ptr++;
delay(10);
}
}

//uart0 接受中断过
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
switch(__even_in_range(UCA0IV,4))
{
case 0:
break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
//阻塞式返回值
while (!(UCA0IFG&UCRXIFG)); // USCI_A0 TX buffer ready?
UCA0IFG &= ~UCRXIFG;//清除标志位
rx = UCA0RXBUF;
break;
case 4:
break; // Vector 4 - TXIFG
default:
break;
}

}

![img](}

img

我就是想问一下为什么改成40mhz就不行,debug时数据为什么会有多余的值

看下这篇博客,也许你就懂了,链接:msp430 f5529寄存器 串口发送接收