Skip to main content
Explorer
Mar 29, 2026 11:04 AM UTC
Solved

A question about the UART irq code generate by cubemx

When a USART is configured without a clock, the code generator treats it as a UART and assigns HAL_UART_IRQHandler as the interrupt handler. However, within this handler, there is a blocking operation during the idle process:(void)HAL_DMA_Abort(huart->hdmarx);

When certain error conditions occur, the code can become stuck in HAL_GetTick(). This happens because the SysTick priority is lower than that of the UART interrupt. I have observed this behavior multiple times, particularly when noise is present on the UART signal line.

Has Anyone seen this situation before?

TDK
TDKBest answer
Mar 29, 2026 2:01 PM UTC

HAL assumes SysTick (or whatever is being used to drive HAL_GetTick) has a higher priority than functions it is called from. It's up to you to ensure this is the case.

"If you feel a post has answered your question, please click ""Accept as Solution""."

1 reply

TDK
TDKBest answer
Mar 29, 2026 2:01 PM UTC

HAL assumes SysTick (or whatever is being used to drive HAL_GetTick) has a higher priority than functions it is called from. It's up to you to ensure this is the case.

"If you feel a post has answered your question, please click ""Accept as Solution""."