I am having trouble echoing received characters from my GPS module to P2.5, It is working with P1.5. I think it might be a configuration issue. Here is the Code
#include <msp430.h> //****************************************************************************** // UART Initialization ********************************************************* //****************************************************************************** #define SMCLK_9600 1 #define UART_MODE SMCLK_9600//SMCLK_9600// void initUART() { // Configure USCI_A0 for UART mode UCA0CTLW0 |= UCSWRST; // Put eUSCI in reset (Port 1) UCA0CTLW1 |= UCSWRST; // Put eUSCI in reset (Port 2) #if UART_MODE == SMCLK_9600 // Port 1 UCA0CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK // Baud Rate Setting // Use Table 21-5 UCA0BRW = 104; UCA0MCTLW |= UCOS16 | UCBRF_2 | 0xD600; //0xD600 is UCBRSx = 0xD6 // Port 2 UCA1CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK // Baud Rate Setting // Use Table 21-5 UCA1BRW = 104; UCA1MCTLW |= UCOS16 | UCBRF_2 | 0xD600; //0xD600 is UCBRSx = 0xD6 #else # error "Please specify baud rate to 115200 or 9600" #endif UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI (Port 1) UCA1CTLW0 &= ~UCSWRST; // Initialize eUSCI (Port 2) UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt (Port 1) UCA1IE |= UCRXIE; // Enable USCI_A0 RX interrupt (Port 2) } //****************************************************************************** // Device Initialization ******************************************************* //****************************************************************************** void initGPIO() { // Configure GPIO P1SEL1 &= ~(BIT4 | BIT5); // USCI_A0 UART operation P1SEL0 |= BIT4 | BIT5; P2SEL1 |= (BIT5 | BIT6); P2SEL0 &= ~(BIT5 | BIT6); // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5; } void initClockTo16MHz() { // Configure one FRAM waitstate as required by the device datasheet for MCLK // operation beyond 8MHz _before_ configuring the clock system. FRCTL0 = FRCTLPW | NWAITS_1; __bis_SR_register(SCG0); // disable FLL CSCTL3 |= SELREF__REFOCLK; // Set REFO as FLL reference source CSCTL0 = 0; // clear DCO and MOD registers CSCTL1 &= ~(DCORSEL_7); // Clear DCO frequency select bits first CSCTL1 |= DCORSEL_5; // Set DCO = 16MHz CSCTL2 = FLLD_0 + 487; // set to fDCOCLKDIV = (FLLN + 1)*(fFLLREFCLK/n) // = (487 + 1)*(32.768 kHz/1) // = 16 MHz __delay_cycles(3); __bic_SR_register(SCG0); // enable FLL while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // FLL locked CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; } //****************************************************************************** // Main ************************************************************************ // Enters LPM0 if SMCLK is used and waits for UART interrupts. If ACLK is used * // then the device will enter LPM3 mode instead. The UART RX interrupt handles * // the received character and echoes it. * //****************************************************************************** int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog initGPIO(); initClockTo16MHz(); initUART(); #if UART_MODE == SMCLK_9600 __bis_SR_register(LPM3_bits + GIE); // Since ACLK is source, enter LPM3, interrupts enabled #else __bis_SR_register(LPM0_bits + GIE); // Since SMCLK is source, enter LPM0, interrupts enabled #endif __no_operation(); // For debugger } //****************************************************************************** // UART Interrupt *********************************************************** //****************************************************************************** //Port 1 #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; __no_operation(); break; case USCI_UART_UCTXIFG: break; case USCI_UART_UCSTTIFG: break; case USCI_UART_UCTXCPTIFG: break; } } //Port 2 #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A1_VECTOR __interrupt void USCI_A1_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void) #else #error Compiler not supported! #endif { switch(__even_in_range(UCA1IV, USCI_UART_UCTXCPTIFG)) { case USCI_NONE: break; case USCI_UART_UCRXIFG: while(!(UCA1IFG&UCTXIFG)); UCA1TXBUF = UCA1RXBUF; __no_operation(); break; case USCI_UART_UCTXIFG: break; case USCI_UART_UCSTTIFG: break; case USCI_UART_UCTXCPTIFG: break; } }