Part Number: TM4C1294NCPDT
Hi Folks,
I have to use UART (UART7) in my application configured in 9 bit UART mode. I implemented the logic that the end of receiving will be signed by the RX timeout interrupt. The interrupt service routine is below:
void Interrupt() {
uint32_t intState = MAP_UARTIntStatus(MODBUS_UART, true);
if (intState & UART_INT_9BIT) {
// first write must be the slave address
_receivedPDU.Deserialize(static_cast<uint8_t>(MAP_UARTCharGet(MODBUS_UART)));
MAP_UARTIntClear(MODBUS_UART, UART_INT_9BIT);
}
if (intState & UART_INT_RX) {
while (MAP_UARTCharsAvail(MODBUS_UART)) {
_receivedPDU.Deserialize(static_cast<uint8_t>(MAP_UARTCharGet(MODBUS_UART)));
}
}
if (intState & UART_INT_RT) {
xSemaphoreGiveFromISR(_receiveSemaphore, NULL);
MAP_UARTIntClear(MODBUS_UART, UART_INT_RT);
}
}
As you can see, there are three conditions:
- check if we received address frame
- check if we should read out data
- check timeout: notify a FreeRTOS thread about receive complete
The FreeRTOS thread looks, like:
SetRS485DriverToTxDir();
Send9BitAddress()
SendByte();
while(UARTBusy());
SetRS485DriverToRTxDir();
// Wait for the semaphore for 50 ms
if (xSemaphoreTake(_receiveSemaphore, 50) == pdFALSE) {
return false;
}
}
But I experienced, that I get receive timeout interrupt, even there is nobody who send me data (no cable is connected to the board), so the semaphore will be acquired and not timed out. One more information: As I checked the periphery via debugger, I saw that the data register holds 0x500, which is:
- Break error
- Parity error
- Empy data (data = 0x0)
Can anybody help me, what can cause this strange behavioral?