Part Number: MSP430F5529
Other Parts Discussed in Thread: MSP-EXP430F5529LP
Hi All (again), I am trying to play around with UART on MSP-EXP430F5529LP (MSP5529 launch pad). I have configured my SMCLK to 4MHz and try to configure the UART to run at 115,200kbps. I am starting simple by sending only one character 'A' (0x41). I have my scope hooked up to PIN3.3 and trigger to see the waveform to confirm my UART is doing what it supposed to
Here is my code to configure it:
#include <msp430f5529.h>
void ConfigUCS (void)
//Configure SMCLK to 4MHz
{
P5SEL |= BIT2 | BIT3;//Configure IO as XT2 function
UCSCTL6 &= ~XT2OFF;//Enable XT2
UCSCTL4 |= SELA_2;//first configure ACLK source as REFCLK
UCSCTL3 |= SELREF_2;//Configure FLLCLK source as REFCLK
while (SFRIFG1 & OFIFG) {
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);//Clear the three types of clock flags
//There are three flag bits that need to be cleared because any
//The flag bit will set OFIFG
SFRIFG1 &= ~OFIFG;//Clear clock error flag
}
UCSCTL4 = UCSCTL4 & (~(SELS_7 | SELM_7)) | SELS_5 | SELM_5;//Configure SMCLK and MCLK clock sources as XT2
//P2SEL |= BIT2;
//P2DIR |= BIT2;//For measuring SMCLK
return;
}
void ConfigURART (void)
{
UCA0CTL1 |= UCSWRST; // Software reset of UCA0 module
UCA0CTL0 |= UCMSB; // Initialize control register UCA0XTL0
// default is no Parity / MSB first / 8bit / One stop bit / UART / Asynchrnoous mode
UCA0CTL1 |= 0x00; // Initialize control register UCA0CTL1
UCA0CTL1 |= UCSSEL_2;// Set SMCLK (SMCLK is at 4MHz) to BRCLK.
UCA0MCTL |= UCOS16; // Oversampling mode
// N = 4,000,000/115,200 = 34.722
UCA0BR1 |= 0x00;
UCA0BR0 |= 0x02; // UCBR0 = INT (N/16) = 2
UCA0MCTL|= UCBRF1; // UCBRF0 = 2
UCA0MCTL|= UCBRS1 + UCBRS0; // UCBRS0 = 3
P3SEL |= BIT3 + BIT4;// Port Configuration
UCA0CTL1 &= ~UCSWRST; // Software reset of UCA0 module cleared
}
/**
* main.c
*/
int main(void)
{
ConfigUCS();
ConfigURART();
UCA0TXBUF = 'A';
}
SMCLK is configured properly as I can measure 4MHz clock on P2.2. However, when I put my scope on P3.3 (UCA0TXD), I got very weird waveform. The waveform almost suggested that there's something wrong on the hardware side. Did I make a mistake in the configuration or my hardware is somehow damaged?
Here is the scope capture:

C1 is a x10 probe at P3.3. To my understanding, the UART bus should be at 3.3V when no transmitting, but here I am seeing some garbage less than 200mV...Any ideas? Thanks.






