Skip to main content
Explorer
March 29, 2026
Solved

A question about the UART irq code generate by cubemx

  • March 29, 2026
  • 1 reply
  • 117 views

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?

Best answer by TDK

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.

1 reply

TDK
TDKBest answer
Super User
March 29, 2026

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""."