Tool/software: Code Composer Studio
Hi,
I'm trying to configure my UART to use a SMCLK with a frequency of 16 MHz, and also using an external oscillator (XT2CLK). I've tried configuring the baud rate and modulation from the User's Guide and reading the Basic Clock Module chapter in the User's Guide as well. Every time I test the UART comm pin on my MCU, I don't seem to be getting a consistent stream of serial data. I've added my UART config code below. Am I overlooking an extra calibration control register or do need to get rid of any registers in my code?
UART Initialization
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD
BCSCTL2 = SELM_2 | DIVM_0 | SELS | DIVS_1;
DCOCTL = 0x00;
BCSCTL1 |= DIVA_0;
BCSCTL1 &= ~XT2OFF;
BCSCTL3 = XT2S_3 | LFXT1S_0 | XCAP_0;
CCTL0 = CCIE; // CCR0 interrupt enabled
CCR0 = 40000;
TACTL = TASSEL_2 + MC_2; // SMCLK, contmode
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // Clock Source SMCLK
UCA0BR0 = 138; // 16MHz 115200
UCA0BR1 = 0; // 16MHz 115200
UCA0MCTL = UCBRS_7 + UCBRF_0; // Modulation UCBRSx = 7
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
Thanks