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.

MSP-EXP430G2: Setting 115200 baud rate with 16MHz DCO or ACLK

Part Number: MSP-EXP430G2

Hello, according to the family user guide 15.3.10 Setting a Baud Rate,

N = fBRCLK / Baud rate

UCBRx = INT(N)

UCBRSx = round( ( N – INT(N) ) × 8 )

is shown. I have configured setting a 115200 baud rate with a 1MHz SMCLK.

BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 8; // 1MHz 115200
UCA0BR1 = 0; // 1MHz 115200
UCA0MCTL = UCBRS2 + UCBRS0; // Modulation UCBRSx = 5
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt

However, I wanted to use a faster clock speed up to 16MHz.

 

I have the MSP-EXP430G2 and I use CCS 8 on Windows 10. The 32kHz crystal is soldered on my launchpad.

These are my questions;

1. According to the baud rate formula, if I choose ACLK,

UCA0CTL1 |= UCSSEL_1; // ACLK
UCA0BR0 = 0; // N = 32768 / 115200 = 0.28444, INT(N) = 0
UCA0BR1 = 2; // round( ( N – INT(N) ) × 8 )

this is my result.

However, can I use that? I think this won't work since UCA0BR0 is equal to zero and I cannot find that combination on this table.

So, if I choose ACLK for the baud rate generator, I cannot create a 115200 baud rate?

2. If I choose DCO as 16MHz and SMCLK for the baud rate generator,

BCSCTL1 = CALBC1_16MHZ;
DCOCTL = CALDCO_16MHZ;
BCSCTL2 = DIVS_0; // SMCLK Divider 1

UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 138; // N = 16MHz / 115200 = 138.8888...
UCA0BR1 = 7; // round(7.111)
UCA0MCTL = UCBRS2 + UCBRS0;               // Modulation UCBRSx = 5
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt

Are these the correct values for both UCA0BR0 and UCA0BR1?

3. Suppose the above values were correct.

BCSCTL1 = CALBC1_16MHZ;
DCOCTL = CALDCO_16MHZ;
BCSCTL2 = DIVS_3; // SMCLK Divider 8, SMCLK = 2MHz

UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 17; // N = 2MHz / 115200 = 17.361111...
UCA0BR1 = 3; // round(2.888)
UCA0MCTL = UCBRS2 + UCBRS0;               // Modulation UCBRSx = 5
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt

This will also generate a 115200 baud rate. I'm curious whether CASE 2 (SMCLK = DCO) is better,

for power consumption / clock error / etc,

or CASE 3 (SMCLK = DCO / 8) is better. Or are there any difference?

  • If the divisor BRW (concatenated BR1:BR0) is =0, it is treated as 1. So you can't get 115200 out of a (32kHz) ACLK. Also, I'm not sure you're using BR1 properly -- it should be =0 in all of your cases.

    My calculator says that driving 115200 from a 16MHz clock is accurate within 0.6% (+ DCO accuracy), which is good enough for pretty much any application.

    As I recall, the backchannel UART on the "old" G2 Launchpad (vs the "recent" G2ET) was limited to 9600bps.
  • Bruce McKenney47378 said:
    Also, I'm not sure you're using BR1 properly

    Thanks for pointing that out, Bruce. You are right; I misused between UCBR1 and UCBRS1. Sorry for the confusion

    Bruce McKenney47378 said:
    "old" G2 Launchpad (vs the "recent" G2ET) was limited to 9600bps.

    I am using the old one, but I connected a Bluetooth Module and this works with 115200 baud rate.

    By the way, is there any difference (i.e. Power consumption) when using a divided SMCLK (SMCLK = DCO / 8) for generating a baud rate?

**Attention** This is a public forum