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: msp430fr4133 uart baudrate configuration

Part Number: MSP430FR4133

Hello.

I'm having trouble setting up the msp430fr4133 uart baudrate.

The reference project(msp430fr413x_eusci_uart_standard_transceiver) works well at 9600, 115200 baudrate.

However, it does not work properly at the 1200 baudrate setting that i set...

It seems that it was incorrectly set or omitted, but since I have no experience, it is difficult to set it up.

Refer to the guide document below for setting values.

BRCLK: 32768

Baud Rate: 1200

UCOS16: 1

UCBRx: 1

UCBRFx: 11

UCBRSx: 0x25

In the basic example, I changed only the uart_init function part to look like this.
(I'm not sure how to do the part of setting BRCLK to 32768)

void initUART_1200()
{
    // Configure USCI_A0 for UART mode
    UCA0CTLW0 |= UCSWRST;                    

    //UCA0CTLW0 |= UCSSEL__SMCLK;               
    UCA0CTLW0 |= 0x0010; 
    // Baud Rate Setting
    // Use Table 21-5
    UCA0BRW = 8;
    UCA0MCTLW |= UCOS16 | UCBRF_11 | 0x2500;   

    UCA0CTLW0 &= ~UCSWRST;                    
    UCA0IE |= UCRXIE;                         
}

Below is the main part(reference). Are there any parts that need to be changed in other parts as well?

int main(void)
{
  WDTCTL = WDTPW | WDTHOLD;                 // Stop Watchdog

  initGPIO();
  initClockTo16MHz();
  //initUART();
  initUART_1200();

#if UART_MODE == SMCLK_9600
    __bis_SR_register(LPM0_bits + GIE);       // Since ACLK is source, enter LPM0, interrupts enabled
#else
    __bis_SR_register(LPM0_bits + GIE);       // Since SMCLK is source, enter LPM0, interrupts enabled
#endif
  __no_operation();                         // For debugger
}

Is there any example code with uart baudrate set to 1200? T.T

thanks

  • Hi Jinbae,

    There is an on-line calculator that will determine the values.

  • Thanks for the quick reply.

    I know the value for setting 1200 baudrate through the documentation, but the problem is I don't know if I applied that value correctly.

    void initUART_1200()
    {
    // Configure USCI_A0 for UART mode
    UCA0CTLW0 |= UCSWRST;

    //UCA0CTLW0 |= UCSSEL__SMCLK;(reference code 115200 baudrate)
    UCA0CTLW0 |= 0x0010; // -> T.T (I have no idea)


    UCA0BRW = 1; // clock Prescalar = 1
    UCA0MCTLW |= UCOS16 | UCBRF_11 | 0x2500; // oversampling = 1 | First modulation = 11 | second modulation = 37

    UCA0CTLW0 &= ~UCSWRST;
    UCA0IE |= UCRXIE;
    }

    In the above code, it seems that the UCSSEL__SMCLK part of the existing reference code should be set to 32768 clock(xt1?), but I do not know which value to mapping... 

    On the document, the types of clocks that can be used uclk, device specific, and smclk. it seems that aclk is not available. How can I set the 32k clock?

    am I taking the wrong focus at all?

  • Ordinarily you would use UCSSEL__ACLK (with UCOS16=0 and BRW=32768/1200=27) but per data sheet (SLAS865D) Table 6-6 you can't use ACLK (nor any low-frequency clock) for UCSSEL.

    I suggest using UCSSEL__SMCLK (=1MHz) with BRW=833.

  • Thank you! I will try to do

**Attention** This is a public forum