cancel
Showing results for 
Search instead for 
Did you mean: 

[stm32u585] program is stuck in HAL_UART_IRQHandler with TC flag

lll
Associate III

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:

1.PNG2.PNG

and HAL_UART_IRQHandler return at /* End if some error occurs */

1 REPLY 1
Saket_Om
ST Employee

Hello @lll 

Did you investigate why it is not clearing the TC flag inside HAL_UART_IRQHandler?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om