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.

MSP430FR5969: EUSCI_A_UART_receiveData() skips UART input

Part Number: MSP430FR5969

I have implemented a UART interrupt, and am sending ASCII characters through a python script to my MSP 430. When these characters are sent at a speed faster than 1 character / 0.1 seconds, the interrupt misses characters, and are not added into my buffer.

I am running with a baud rate of 9600 baud and a clock speed of 1,048,576 Hz.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
* UART receive interrupt
*/
#pragma vector = USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
switch (__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG)) {
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
command_char = EUSCI_A_UART_receiveData(EUSCI_A0_BASE);
char_rcvd = true;
break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • When I use an ISR to receive serial data I always store the data into a FIFO buffer. So the rest of the program can get side tracked by something else for a while without missing data. Which brings up the question of the rest of your program. The ISR isn't going to miss data but your program might not get to it in time. Hard to say without knowing what else is going on.

  • Recommend to read the data from the RX data register directly like below

    while(!(UCA0IFG&UCTXIFG));
    UCA0TXBUF = UCA0RXBUF;

    And agree with David that to use a buffer array to receive the data.

  • Toggle a GPIO from the interrupt so you can see whether it is the EUSCI_A_UART_receiveData(EUSCI_A0_BASE); or your main loop that is missing the data.

    ETA: you can also toggle a GPIO when you read in the main loop for a more direct comparison.

**Attention** This is a public forum