CubeMX 6.17.0: Incorrect ISR generation (HAL_UART_IRQHandler for IrDA) in Shared IRQ
- April 8, 2026
- 1 reply
- 158 views
Description:
In STM32U083 series, when multiple UART/LPUART instances share the same NVIC interrupt vector (e.g., `USART3_LPUART1_IRQn`), STM32CubeMX incorrectly generates `HAL_UART_IRQHandler` for all instances, even if one of them is configured in IrDA mode.
This leads to a compilation error because:
1. The handle for the IrDA instance is generated as IRDA_HandleTypeDef hirdax; (correct).
2. However, in stm32u0xx_it.c, it attempts to call HAL_UART_IRQHandler(&huartx); using an undefined huartx handle.
Environment:
- STM32CubeMX Version: 6.17.0
- OS: Ubuntu 24.04 LTS
- MCU: STM32U083RCTx
- Firmware Package: STM32Cube FW_U0 V1.3.0
Steps to Reproduce:
1. Create a new project for STM32U083RCTx.
2. Configure USART3 mode as IrDA.
3. Configure LPUART1 mode as Asynchronous.
4. In the NVIC Settings tab, enable the interrupt for "USART3 + LPUART1 global interrupt".
5. Generate the code.
6. Check `stm32u0xx_it.c`.
Actual Result:
The generated ISR code looks like this:
/**
* @brief This function handles USART3 (combined with EXTI 24) + LPUART1 global interrupt (combined with EXTI lines 28).
*/
void USART3_LPUART1_IRQHandler(void)
{
/* USER CODE BEGIN USART3_LPUART1_IRQn 0 */
/* USER CODE END USART3_LPUART1_IRQn 0 */
HAL_UART_IRQHandler(&huart3);
HAL_UART_IRQHandler(&hlpuart1);
/* USER CODE BEGIN USART3_LPUART1_IRQn 1 */
/* USER CODE END USART3_LPUART1_IRQn 1 */
}As a result, the compiler throws an error: "huart3 undeclared" because the handle was correctly defined as hirda3.
Expected Result:
The generator should recognize the peripheral mode and call the appropriate HAL handler:
/**
* @brief This function handles USART3 (combined with EXTI 24) + LPUART1 global interrupt (combined with EXTI lines 28).
*/
void USART3_LPUART1_IRQHandler(void)
{
/* USER CODE BEGIN USART3_LPUART1_IRQn 0 */
/* USER CODE END USART3_LPUART1_IRQn 0 */
HAL_IRDA_IRQHandler(&hirda3);
HAL_UART_IRQHandler(&hlpuart1);
/* USER CODE BEGIN USART3_LPUART1_IRQn 1 */
/* USER CODE END USART3_LPUART1_IRQn 1 */
}
Please check the attached ioc file.
Best Regards,
fumihiko
