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.

MSP430 UART overrun Error

Other Parts Discussed in Thread: MSP430F6659

Hello All,

I am using MSP430 for my project. While UART communication, I have received Overrun error frequently. During debugging, I have add queue in UART interrupt to check received byte, But I have found that, I haven't missed any single byte in queue, but overrun flag set.

I have read all blogs in forum regarding overrun error. but still facing same issue.

Kindly suggest.


Thanks and Regards,
Rahul

  • The MSP does not know about your queue. And overrun error happens when your RX interrupt is no executed early enough. This is probably caused by some other interrupt that executes for too long.
  • Hello Clemens,

    Thanks for reply.

    Queue code that I used to read data from interrupt is as follow

    volatile unsigned char data[196];
    volatile unsigned char errData[196];
    volatile unsigned char index = 0;

    #pragma vector=USCI_A1_VECTOR
    __interrupt void USCI_A1_ISR (void)
    {
        switch (__even_in_range(UCA1IV, USCI_UCTXIFG)) {
              case USCI_NONE:

              break;
             case USCI_UCRXIFG:
             {
                  data[index] = UCA1RXBUF;
                  errData[index] = UCA1STAT;
                  index++;
                  if(index >= 196)
                  {
                       index = 0;
                  }
             }
             break;
             case USCI_UCTXIFG:

             break;
         }
    }


    Other Interrupt using in code
    Timer0_A
    Timer0_B

    I have disable "Timer0_B" and execute UART code. but still I have received overrun error. I am using MSP430F6659 micro controller.

    Thanks and Regards,
    Rahul Patil

  • Hi Rahul!

    In your interrupt you are reading the receive buffer and then you read the status register. Reading the receive buffer clears the overrun flag, so I am wondering how you will have a set flag at all. Are you sure you are testing for the right flag?

    Dennis

  • Hi Dennis

    Little bit correction in code. First reading error code and then data.

    volatile unsigned char data[196];
    volatile unsigned char errData[196];
    volatile unsigned char index = 0;

    #pragma vector=USCI_A1_VECTOR
    __interrupt void USCI_A1_ISR (void)
    {
    switch (__even_in_range(UCA1IV, USCI_UCTXIFG)) {
    case USCI_NONE:

    break;
    case USCI_UCRXIFG:
    {
    errData[index] = UCA1STAT;
    data[index] = UCA1RXBUF;
    index++;
    if(index >= 196)
    {
    index = 0;
    }
    }
    break;
    case USCI_UCTXIFG:

    break;
    }
    }



    Thanks and Regards,
    Rahul Patil
  • Hello All

    I am using MSP430F6659 and HART IC (On semiconductor Serial HART modem)  in my project. Both MSP430 and HART modem communicate using UART (Rx,Tx and RTS pin). 

    Problem is, Whenever I have received data from HART modem,on every first byte of HART frame, I received overrun error flag and frame was discarded.

    Kindly suggest, how can I resolved it.


    volatile unsigned char data[196];
    volatile unsigned char errData[196];
    volatile unsigned char index = 0;

    #pragma vector=USCI_A1_VECTOR
    __interrupt void USCI_A1_ISR(void)
    {
           switch(__even_in_range(UCA1IV,USCI_UCTXIFG))
           {
            case USCI_NONE:
            break;

            case USCI_UCRXIFG:
                  ByteStatus = UCA1STAT;
                  Byte = UCA1RXBUF;

                  data[index] = Byte;

                  ByteStatus &= (UCPE | UCFE| UCOE);

                  errData[index] = ByteStatus;
                  index++;
                  if(index >= 196)
                          index = 0;
                  break;

                 case USCI_UCTXIFG:
                 break;
              }
    }

    errData while debugging
    [0] -> 0x00
    [1] -> 0x00
    [2] -> 0x00
    [3] -> 0x00
    [4] -> 0x00
    [5] -> 0x00
    [6] -> 0x00
    [7] -> 0x00
    [8] -> 0x00
    [9] -> 0x20
    [10] -> 0x00
    [11] -> 0x00

    Thanks and Regards,
    Rahul

  • Did you check if it isn't set already before the first data byte comes in? I never worked with the ON Semi HART modem, but maybe during startup it outputs some garbage that is interpreted as a valid byte by the MSP.

**Attention** This is a public forum