I am using an MSP430 (MSP430x5xx family) MCU. The code base currently has incoming and outgoing message handling code using UART0. This works most of the time, but I just noticed that occasionally comms appears to go down.
After debugging I found that we are able to receive data with no problem, but at some point the Tx ISR stops triggering so no data ever gets sent. If I manually set the UCA0IFG Tx bit in the debugger, things will start to work again until the error condition pops up again. When I am in the bad state, the Tx interrupt is enabled.
Does anyone have any idea what would stop the Tx ISR from firing?
The following is my Tx ISR code:
UCA0IE &= ~UCTXIE; // Disable tx interrupt
if(numBytesInTxQueue == 0)
{ // Clear interrupt if nothing left in queue
UCA0IFG &= ~UCTXIFG;
}
else
{
UCA0TXBUF= txByteQueue[readIndex++]; // Add next byte in queue to buffer
numBytesInTxQueue--;
}
UCA0IE |= UCTXIE;