cancel
Showing results for 
Search instead for 
Did you mean: 

Do transmit interrupts interfere with receive interrupts, causing packet drops?

AIsma
Associate II

I have a simple application with the goal to fill a ring buffer with bytes received on the uart, while always transmitting 'E' at the same time. The UART uses both the RX and TX FIFOs. The only code running in the main thread is :

uint8_t data = 0x45; // 'E'
while(1)
{
   HAL_UART_Transmit(&huart3, &data, 1);
}

I handle the receives with my own huart->RxIsr, I do the following:

while(huart->Instance->ISR & USART_ISR_RXNE_RXFNE)
{
   dataReg = (uint16_t) READ_REG(huart->Instance->RDR);
   data = (uint8_t)(dataReg & (uint8_t)mask);
   ringBuffer->add(data);
}

When I attempt to send 1000 bytes from real term to my evaluation board, I do not receive all 1000 bytes. I get 488 or 232 bytes. When debugging, I do not see an overrun interrupt, so I don't see why I would be dropping packets. Even with full-duplex, can the continuous transmit interrupts cause the UART to miss bytes?

2 REPLIES 2

Shouldn't lose data, make sure not to look at the UART peripheral in the debugger (peripheral view) as this will cause data loss. Check also if you have noise, framing errors, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

To avoid issues with the debugger, I installed a binary and I can tell that the bytes are still not being received. I went back to debugging and noticed I am getting a ton of noise errors. If I send 100 bytes, I get about 85 noise errors. If I send 1000 bytes, I get 407 noise errors. I seem to get 0 framing, overrun, or any other issues. Could it be a problem that I am using the UART pins connected to the microUSB cable used for debugging and powering the evaluation board?