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.

msp430FR2433串口发送0x00,收到却是0xf0

Other Parts Discussed in Thread: MSP430FR2433
最近用msp430fr2433做个程序,实现通过串口uart0跟外部pc通讯,今天遇见一个问题,我发送一串十六进制数据时,第一个0x00的数据在接收端变成了0xe0,其他的数据都正确。比如我发送01 03 0C 00 0F 01 F4 00 0F 01 F4 00 0F 01 F4 BB 75 ,在pc用串口工具收到的数据是 01 03 0C F0 0F 01 F4 00 0F 01 F4 00 0F 01 F4 BB 75 ,第四个数从0x00变成了0xf0,暂时还没到找原因,看看网上有没有老师遇到过这种情况。备注一下:
1. 这种情况在波特率9600时出现,改为115200就没有问题
2. 串口的接收没有问题
3. 频率8M
4. uart0的初始化如下:
void uart0Init(int rate)
{

    // Configure UART pins
    P1SEL0 |= BIT4 | BIT5;                    // set 2-UART pin as second function
    PM5CTL0 &= ~LOCKLPM5;                    // Disable the GPIO power-on default high-impedance mode

    // Configure UART
    UCA0CTLW0 |= UCSWRST;
    UCA0CTLW0 |= UCSSEL__SMCLK;

    if(rate == e_UART_RATE_115200)
    {
        UCA0BR0 = 4;                             // 8000000/115200/16 = 4.34
        UCA0BR1 = 0x00;
        UCA0MCTLW = 0x5500 | UCOS16 | UCBRF_5;                   //0.34
    }
    else
    {
    // Baud Rate calculation
    // 8000000/(16*9600) = 52.083   3
    // Fractional portion = 0.083FDS
    // User's Guide Table 22-4: UCBRSx = 0x49
    // UCBRFx = int ( (52.083-52)*16) = 1
       UCA0BR0 = 52;                             // 8000000/16/9600
       UCA0BR1 = 0x00;
       UCA0MCTLW = 0x4900| UCOS16 | UCBRF_1;

    }

    UCA0CTLW0 &= ~UCSWRST;                    
    UCA0IE |= UCRXIE;                        
}
void uart0SendChar(u8 c)
{
    while(!(UCA0IFG & UCTXIFG));
    UCA0TXBUF = c;
}

void uart0Send(u8 *buf, int len)
{
    int i;
    crc16_pre = 0xFFFF;

    for(i = 0; i < len; i++)
    {
        crc16_pre = crc16(crc16_pre,buf[i]);

        uart0SendChar(buf[i]);
    }

    uart0SendChar(crc16_pre & 0xff);
    uart0SendChar((crc16_pre >> 8) & 0xff);

}

又遇到同样情况的老师,麻烦给予一点经验或者建议,谢谢~