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 multiple messages

Part Number: MSP430FR2000

Tool/software: Code Composer Studio

Hello,

I am receiving 3 messages from UART and loading the value into RTCMOD. But I am unable to receive them. I am getting same message for all the 3 as the first message. I have attached the UART interrupt below.

Regards,

Prudhvi Sagar

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

//Turn OFF UART everytime.....
#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));
                      if(RX_count == 0)
                      { 
                          RX_temp = UCA0RXBUF;
                          RX_temp = (RX_temp << 8);
                          RX_count++;       //Count = 1
                      }
                      if(RX_count == 1)
                      {
                          
                          RX_temp |= UCA0RXBUF;
                          RTCMOD = RX_temp;
                          RX_count++;      //Count = 2
                      }
                      if(RX_count == 2)
                      {
                         
                          increment = UCA0RXBUF;
                          RX_count++;      //Count = 3
                      }
                      //Implement for increment
                    if(RX_count >= 3)    // check for all byte RX
                  {
                   RX_count = 0;

                   RTCCTL = RTCSS__XT1CLK | 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;
  }
}

  • Hi Prudhvi

    What's the baud rate do you use? Can you make it more slower like 9600. You can capture the waves of TX and RX to see if the signal is right.
  • void initUART()
    {
        // Configure USCI_A0 for UART mode
        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
    }

    Hello,

    Yes I am using 9600 baud rate. My code uart initialization is given below: 

    The first message IM receiving is correct but the same message is being applied for second and third message as well

    Regards,

    Prudhvi Sagar

  • Hi Prudhvi
    What's the other side of the UART, PC or other mcu? Can you make sure the other device sand the different messages, you'd better to capture the waves by a logic analyzer.
    The second is what is "__bis_SR_register_on_exit(LPM3_bits | GIE);" do you want to leave or inter LPM3? I know if you want to leave you can use
    "__bic_SR_register_on_exit(LPM3_bits);" if you want to inter it should be "__bis_SR_register(LPM3_bits | GIE); "
    Thanks
  • > if(RX_count == 1)
    RX_count will always be ==1 here, since you just incremented it. Try "else if". Similarly for the ==2 check.

**Attention** This is a public forum