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.

MSP430G2453 UART Issue

Other Parts Discussed in Thread: MSP430G2453

I am using MSP430G2453  microcontroller on UART communication.  The UART has been set as 115200-8-N-1 and interrupt  module. I found there are times where the UART can't receive any massage,  but can still send messages, after MCU worked several hours. This issue doesn’t always happen since I have 8 boards and only 2 boards have this issue.

 

void Init_UART(void)

{

  P1SEL |= BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD

  P1SEL2 |= BIT1 + BIT2;                     

  

  UCA0CTL1 |= UCSSEL_2;                     // SMCLK

   

  UCA0BR0 =69;                              // 8MHz 115200 See User GuideP435

  UCA0BR1 = 0;                              // 8MHz 115200  ;

  UCA0MCTL = 8;                             // Modulation UCBRSx = 0;

   

  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**

 

  Rbuf_init (&RTbuf_UART0);                 //init ring buffer  UART0

 

  IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

}

 

 

void sendstring(char * str)

{

  Tx_str = str;

   UART_TX_Int = TRUE;

  IE2 |= UCA0TXIE;                        // Enable USCI_A0 TX interrupt

}

 

#pragma vector=USCIAB0RX_VECTOR

__interrupt void USCI0RX_ISR(void)

{

    uint8          data;

    sioCirQueue_t  *pRTbuf;

    pRTbuf = &RTbuf_UART0;

    data = UCA0RXBUF;

    {

        if (pRTbuf->lvl < RBUF_SIZE)  //  Handle circle buffer

        {

            pRTbuf->lvl++;

            pRTbuf->buf[pRTbuf->pp] = data;

            pRTbuf->pp = (pRTbuf->pp + 1) % RBUF_SIZE;

        } else

        {

           pRTbuf->overflow = 1;

           pRTbuf->cp = 0;

           pRTbuf->pp = 0;

           pRTbuf->lvl = 0;  

           pRTbuf->hiwtrmark = 0;

        }

    }

    if ( data == 0x0D) //0x0d -> carriage return, \r; 0x0a->new line \n;

    {

      events |= RX_BT_MSG_EVENT;

      __bic_SR_register_on_exit(LPM3_bits);         // Exit active CPU, polling

    }

  

}

 

Thanks for any help,

 

Kevin

**Attention** This is a public forum