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/MSP430FR5994: UART on Launchpad - Trouble testing echo code

Part Number: MSP430FR5994

Tool/software: Code Composer Studio

I am trying to test the following code for testing UART on launchpad but upon running the code, the receive buffer (UCA0RXBUF) does not show any recieved hex code. Also, I have programmed an LED to switch off when the character from the transmit buffer(UCA0TXBUF) echoes to the recieve buffer(UCA0RXBUF). But it does not work. Requesting help!

#include <msp430.h> 
 volatile unsigned int i;
/*
 * main.c
 */
 int main(void) {
  WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

  // Set P2.0 and P2.1 for USCI_A0 UART operation
  P2SEL0 &= ~(BIT0 | BIT1);
  P2SEL1 |= BIT0 | BIT1;

  P1DIR |= BIT0; 		//conf LED at P1.0 for debugging
  P1OUT |= BIT0; 	//LED P1.0 switched on at startup

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

  // Startup clock system with max DCO setting ~8MHz
  CSCTL0_H = CSKEY >> 8; 				// Unlock clock registers
  CSCTL1 = DCOFSEL_3 | DCORSEL; 		// Set DCO to 8MHz
  CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;
  CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
  CSCTL0_H = 0; 						// Lock CS registers


  // Configure USCI_A0 for UART mode

  UCA0CTLW0 = UCSWRST; 			// enable software reset
  UCA0CTLW0 |= UCSSEL__SMCLK; 	// CLK = SMCLK

  // Baud Rate calculation
  // 8000000/(16*9600) = 52.083
  // Fractional portion = 0.083
  // UCBRFx = int ( (52.083-52)*16) = 1
  UCA0BR0 = 52; 				// 8000000/16/9600
  UCA0BR1 = 0x00;
  UCA0MCTLW |= UCOS16 | UCBRF_1 | 0x4900;

  UCA0CTLW0 &= ~UCSWRST; 		// Initialize eUSCI, disable software reset
  UCA0IE |= UCRXIE; 			// Enable USCI_A0 RX interrupt

  UCA0TXBUF = 0x41; 				//test send 'A'

 __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=USCI_A0_VECTOR
  __interrupt void USCI_A0_ISR(void)

  #elif defined(__GNUC__)
  void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
  #else
  #error Compiler not supported!
  #endif
  {
	  switch(__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG))
	  {
		  case USCI_NONE:
			  break;
		  case USCI_UART_UCRXIFG:
			  while(!(UCA0IFG & UCTXIFG));
			  UCA0TXBUF = UCA0RXBUF; 		//echo
			  P1OUT &= ~BIT0;				//LED P1.0 switched off
			  __no_operation();
			  break;
		  case USCI_UART_UCTXIFG:
			  break;
		  case USCI_UART_UCSTTIFG:
			  break;
		  case USCI_UART_UCTXCPTIFG:
			  break;
	  }
 }

**Attention** This is a public forum