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/MSP430FR2000: Unable to receive UART data in P1.2

Part Number: MSP430FR2000


Tool/software: Code Composer Studio

Hello,

I have written a code where FR2000 receives data from UART and starts an RTC based on the data it received in UART. The exact same code works fine for P1.6 but doesnt work for P1.2 but the datasheet shows UCA0RXD. 

#include <msp430.h>

/* Global Variables */
#if defined(__IAR_SYSTEMS_ICC__)
__persistent volatile unsigned char timeIncrement = 0; //Software Count Variable
 #elif defined(__TI_COMPILER_VERSION__)
#pragma PERSISTENT(timeIncrement)
volatile unsigned char timeIncrement = 0;              //Software Count Variable
#endif

/* Constant Definitions */
#define INCREMENT 0  // Software Count Interval, change this to increase
                     // Wake-up Time.

#define SMCLK_115200    0
#define SMCLK_9600      1

#define UART_MODE       SMCLK_9600//SMCLK_9600//

void initGpio(void);
void initUART(void);
void initClockTo16MHz(void);

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

    // Configure GPIO
    initGpio();                             // Configure GPIO

    initUART();

    initClockTo16MHz();

    P1OUT ^= BIT4;

    do
    {
        CSCTL7 = 0;             // Clear XT1 fault flag
        SFRIFG1 = 0;            // Clear fault flag
    } while (SFRIFG1 & OFIFG);  // Test oscillator fault flag


    CSCTL4 = SELA__XT1CLK;           // Set ACLK = XT1CLK = 32768Hz...CHANGE: initial for use internal clock REFO
    P1IFG = 0x00;                            //Clear P1.3 IFG

    __bis_SR_register(LPM3_bits | GIE);     // Enter LPM3, enable interrupt
}


void initGpio(void)
{
    P1DIR = 0xFF; P2DIR = 0xFF;
    P1REN = 0xFF; P2REN = 0xFF;
    P1OUT = 0x00; P2OUT = 0x00;

    P2SEL1 = BIT6 | BIT7;            // P2.6~P2.7: crystal pins
    SYSCFG0 = FRWPPW;            // Enable FRAM write access

    P1SEL0 |= BIT6 | BIT7;                    // set 2-UART pin as second function
  //  P1SEL1 &= ~(BIT2 | BIT3);                 // USCI_A0 UART operation
    //P1SEL0 |= BIT2 | BIT3;

    PM5CTL0 &= ~LOCKLPM5;
}

void initClockTo16MHz()
{
    FRCTL0 = FRCTLPW | NWAITS_1;

    __bis_SR_register(SCG0);                 // disable FLL
    CSCTL3 |= SELREF__XT1CLK;                // Set XT1 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;                  // DCOCLKDIV = 16MHz
    __delay_cycles(3);
    __bic_SR_register(SCG0);                     // enable FLL
    while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1));   // FLL locked

    do
    {
        CSCTL7 = 0;             // Clear XT1 fault flag
        SFRIFG1 = 0;            // Clear fault flag
    } while (SFRIFG1 & OFIFG);  // Test oscillator fault flag
}

void initUART()
{
     UCA0CTLW0 |= UCSWRST;                      // Put eUSCI in reset
#if UART_MODE == SMCLK_115200

    UCA0CTLW0 |= UCSSEL__SMCLK;               // CLK = SMCLK
    // Baud Rate Setting
    // Use Table 21-5
    UCA0BRW = 8;
    UCA0MCTLW |= UCOS16 | UCBRF_10 | 0xF700;   //0xF700 is UCBRSx = 0xF7

#elif UART_MODE == SMCLK_9600

    UCA0CTLW0 |= UCSSEL__SMCLK;               // CLK = SMCLK
    // Baud Rate Setting
    // Use Table 21-5
    UCA0BRW = 104;
    UCA0MCTLW |= UCOS16 | UCBRF_2 | 0xD600;   //0xD600 is UCBRSx = 0xD6
#else
    # error "Please specify baud rate to 115200 or 9600"
#endif

    UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
    UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt
}


//******************************************************************************
// UART Interrupt ***********************************************************
//******************************************************************************

#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));

      P1OUT ^= BIT4;

      RTCMOD = UCA0RXBUF;

      RTCCTL = RTCSS__XT1CLK | RTCSR | RTCPS__1024 | RTCIE;
      //RTCCTL = RTCSS_2 | RTCSR | RTCPS__1024 | RTCIE; // Start RTC

             __bis_SR_register_on_exit(LPM3_bits | GIE);
             __no_operation();
      break;
    case USCI_UART_UCTXIFG: break;
    case USCI_UART_UCSTTIFG: break;
    case USCI_UART_UCTXCPTIFG: break;
  }
}

/**
* RTC interrupt service routine
*/
//CHANGE: Keep switch ON and wait indefinitely unitl GPIO interrupt
#pragma vector=RTC_VECTOR
__interrupt void RTC_ISR(void)
{
    switch(__even_in_range(RTCIV,RTCIV__RTCIFG))
    {
        case  RTCIV__NONE:   break;          // No interrupt
        case  RTCIV__RTCIFG:                 // RTC Overflow
            if(timeIncrement >= INCREMENT)
                {
                P1OUT ^= BIT4;

                    timeIncrement = 0;            // Clear Software Counter

                    RTCCTL = RTCSS_2 | RTCSR | RTCPS__1024; //Stop RTC
                    P1IFG = 0x00;                            
                }
                else
                {
                    timeIncrement++ ; 
                }

             __bis_SR_register_on_exit(LPM3_bits | GIE);
             __no_operation();
               break;
        default: break;
    }
}

**Attention** This is a public forum