2026-01-29 7:42 AM
hello
Description:
I'm currently working with the STM32U585 and encountered an issue related to USART3
Most of the time the code works fine, but it occasionally gets trapped in HAL_UART_IRQHandler
I am using the DMA Receiver Timeout (RTO) and DMA TX, may code is:
void uart_tx_complete_cb(UART_HandleTypeDef *huart)
{
if (...)
HAL_UART_Transmit_DMA(huart, buf, len);
}
void uart_rx_error_cb(UART_HandleTypeDef *huart)
{
HAL_UART_AbortReceive(huart);
if (huart->ErrorCode & HAL_UART_ERROR_RTO)
{
...
}
HAL_UART_Receive_DMA(huart, rx_buf, rx_buf_len);
}
HAL_UART_RegisterCallback(&huart3, HAL_UART_ERROR_CB_ID, uart_rx_error_cb);
HAL_UART_ReceiverTimeout_Config(&huart3, 100);
HAL_UART_EnableReceiverTimeout(&huart3);
HAL_UART_Receive_DMA(&TD_UART_HANDLE, rx_buf, rx_buf_len);
HAL_UART_RegisterCallback(&huart3, HAL_UART_TX_COMPLETE_CB_ID, uart_tx_complete_cb);
When the issue occurs, I found that the TC (Transmission Complete) flag is not being cleared:
and HAL_UART_IRQHandler return at /* End if some error occurs */
2026-01-29 7:59 AM
Hello @lll
Did you investigate why it is not clearing the TC flag inside HAL_UART_IRQHandler?