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.

MSP430FR4133 eUSCI_A UART setting of UCAxMCTLW register

Hi,recently I use fr4133 code_example: msp430fr413x_euscia0_uart_01 and found some quention of UCA0MCTLW register. Here is the code_example below.

/**********************************************************************************/

UCA0CTLW0 |= UCSWRST;
UCA0CTLW0 |= UCSSEL__SMCLK;

// Baud Rate calculation
// 8000000/(16*9600) = 52.083
// Fractional portion = 0.083
// User's Guide Table 14-4: UCBRSx = 0x49
// UCBRFx = int ( (52.083-52)*16) = 1


UCA0BR0 = 52; // 8000000/16/9600
UCA0BR1 = 0x00;
UCA0MCTLW = 0x4900 | UCOS16 | UCBRF_1;

UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt

/**********************************************************************************/

The  Fractional portion is 0.083,and i look up for User's Guide Table 14-4,UCBRSx=0x04, but the code_example says UCBRSx=0x49,why?

  • Hi,

    As UG described, UCBRSx can be found by looking up the fractional part of N ( = N - INT(N) ) in table 15-4.
    N=8000000/9600=833.3333, fractional part of N ( = N - INT(N) ) should be 0.3333. Looking up in table 15-4, UCBRSx=0x49.
    The comment "Fractional portion = 0.083" is a little confused here. 0.083 is not fractional part of N.

    Regards,
    Darren

  •  Thanks for your reply. Now, I get confused in it. As you say ,if I setting like this:
    /***********************************************/
    // Baud Rate calculation
    // 8000000/(16*38400) = 13.020
    // Fractional portion = 0.020
    // User's Guide Table 14-4: UCBRSx = 0x49
    // UCBRFx = int ( (13.020-13)*16) = 0
    UCA0BR0 = 13; // 8000000/16/38400
    UCA0BR1 = 0x00;
    UCA0MCTLW = 0x4900 | UCOS16 | UCBRF_0;
    /**********************************************/
    here ,800000/38400=208.333, so UCBRSx should be 0x49,right? But I look up for table 14-5, it says UCBRSx =0x84 ,why?

  • UCBRSx is the 8-bit modulation pattern that will impact TX/RX neg/pos error. Table 14-4 provides some patterns according to different fractions.  Table 14-5 also provide some patterns according to each typical baud rate settings and also TX/RX neg/pos error from error calculation. Both two UCBRSx values(different pattern) can work well.

    Best Regards,
    Darren

  • Thank you so much.
  • For any combination of clock and baud rate (not only those in the table), you can easily compute the register values and the worst-case errors with the USCI UART Calculator in the Wiki.

**Attention** This is a public forum