Other Parts Discussed in Thread: CC430F5137
I have a CC430F5137 MCU with DCO = 24 MHz and SCLK = MCLK = 12 MHz. I'd like to set a serial baudrate of 38400 bps so by following the manual I should do:
N = 12000000 / 38400
UCA0BR = INT(N/16) = 19
UCBRFx = round([(N/16) – INT(N/16)] × 16) = 8
So I'm configuring the USCI registers as follows:
UCA0BR0 = 19;; // Integer part of UART frequency scaler (low byte)
UCA0BR1 = 0; // Integer part of UART frequency scaler (high byte)
UCA0MCTL = UCBRF_8 + UCBRS_0 + UCOS16; // This turns on oversampling and sets the decimal part of the scaler
With the above settings the MCU is sending garbage through the UART. However, if I configure the port for 9600 bps (UCA0BR0 = 78) then I'm able to receive from a serial terminal configured at 38400 bps!! I'm obviously misunderstanding something from the manual.
Thanks for your ideas!