2
\$\begingroup\$

I'm using a MSP430F5529 clocked at 1 MHz and want to use the UART at 9600 bauds. So far I did:

void UART_init(void) {
    UCA0CTL1 |= UCSWRST; // Reset the UART's state machine
    UCA0CTL0 |= UCMSB; // MSB first, 8n1 mode
    UCA0CTL1 |= UCSSEL_2; // SMCLK

    // 1 MHz/9600 baud = 104.666.
    // Rounding down to 104 = 9615 bauds

    UCA0BR0 = 104;
    UCA0BR1 = 0;

}

But now I don't understand how to choose the value of the modulation register (UCA1MCTL) so as to get as close to 9600 bauds as possible. The MSP430Fx5xx user's guide, at page 908, proposes to use UCBRS_1, but I don't understand how this value is reached.

line on the user's guide

How do I calculate this register?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

There are a number of calculators to simplify the process, such as this one; simple msp430 baud rate bit calculator

If you want more detailed information on how this is calculated I recomemend this great tutorial by Gustavo Litovsky Specifically section 12.3.5 on PDF page 101

Hope this helps.

\$\endgroup\$
3
  • \$\begingroup\$ Also, @GustavoLitovsky is a member of Electronics StackExchange, albeit essentially inactive. Perhaps he would be willing to chime in as well. \$\endgroup\$ Commented May 2, 2013 at 13:54
  • \$\begingroup\$ @AnindoGhosh: Never noticed this thread until recently. Thank you. \$\endgroup\$ Commented Dec 28, 2013 at 14:24
  • \$\begingroup\$ In the latest version of the tutorial linked above, it's section 12.3.5 on PDF page 101. \$\endgroup\$ Commented Mar 12, 2015 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.