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.

CCS/MSP430FR5043: could not communicate through UART

Part Number: MSP430FR5043


Tool/software: Code Composer Studio

H,

I am trying to communicate to my MSP430FR5043 custom board through UART. I have attached the code below. I just used the inbuilt library code and modified it to my design. But the code does not work or the serial monitor (putty) has no output. I have configured baud rate to be 9600 and no flow control. My code should transmit digit 1 on the putty window but nothing happening. Please guide me where I am going wrong in my code, since I don't have any example working code to refer to.Below is my code:

#include <msp430.h>

volatile unsigned char RXData = 0;
volatile unsigned char TXData = 1;

int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog

// Configure GPIO

P5SEL0 &= ~(BIT0 | BIT1);
P5SEL1 |= BIT0 | BIT1; // USCI_A2 UART operation
PJSEL0 |= BIT4 | BIT5; // Configure XT1 pins

// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;

// XT1 Setup
CSCTL0_H = CSKEY_H; // Unlock CS registers
CSCTL1 = DCOFSEL_0; // Set DCO to 1MHz
CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
CSCTL4 &= ~LFXTOFF; // Enable LFXT1
do
{
CSCTL5 &= ~LFXTOFFG; // Clear XT1 fault flag
SFRIFG1 &= ~OFIFG;
} while (SFRIFG1 & OFIFG); // Test oscillator fault flag
CSCTL0_H = 0; // Lock CS registers

// Configure USCI_A2 for UART mode
UCA2CTLW1 = UCSWRST;
UCA2CTLW1 |= UCSSEL_2; // Set SMCLK
UCA2BRW = 3; // 9600 baud
UCA2MCTLW |= 0x5300; // 32768/9600 - INT(32768/9600)=0.41
// UCBRSx value = 0x53 (See UG)
UCA2CTLW1 &= ~UCSWRST; // release from reset
UCA2IE |= UCRXIE; // Enable USCI_A2 RX interrupt

__bis_SR_register(LPM3_bits | GIE); // Enter LPM3, interrupts enabled
__no_operation(); // For debugger

}


#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=EUSCI_A2_VECTOR
__interrupt void USCI_A2_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(EUSCI_A2_VECTOR))) USCI_A2_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA2IV, USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
while(!(UCA2IFG&UCTXIFG));
UCA2TXBUF = UCA2RXBUF;
__no_operation();
break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
default: break;
}
}

**Attention** This is a public forum