2026-03-20 12:27 AM - last edited on 2026-03-20 4:31 AM by Andrew Neil
Hi everyone,
I just started developing software for a new project containing on of the STM32L4P5 series microcontrollers. Therefore I bought the NUCELO-L4P5ZG starter-kit to get used to the IDE, HAL and so on. I use the STM32CubeMX IDE (Version 6.16.1) to configure the board and generate the basic initialization sources. Further code writing is done in STM32CubeIDE (Version: 2.1.1).
For the beginning I configured three GPIO pins for the LEDs on the board and the LPUART for simple data transfer to terminal on host computer. For the transmission I want to use DMA . After generating the code with CubeMX and implementing some simple blink logic for the LEDs, I added the line HAL_UART_Transmit_DMA(&hlpuart1, buffer, 14); to the main loop. I debugged the code and saw that the code ran into the infinite loop in the DefaultHandler in the startup file startup_stm32l4p5zgtx.s:
After searching for two and a half hour I finally found the problem: the generated names for the interrupt handler in the startup file and the stm32l4xx_it.c are slightly different. See the following sections:
and
After changing the name manually in the stm32l4xx_it.c file everything works fine (until the next generation of the initialization code with CubeMX).
Please see this as a bug report and consider this issue for new releases of CubeMX.
Attached: my entire project.
Solved! Go to Solution.
2026-03-20 6:07 AM - edited 2026-03-20 6:08 AM
It appears this bug has been fixed. The code generates correctly on the latest STM32CubeMX version. Update your STM32CubeMX to fix this.
.word EXTI0_IRQHandler
.word EXTI1_IRQHandler
.word EXTI2_IRQHandler
.word EXTI3_IRQHandler
.word EXTI4_IRQHandler
.word DMA1_Channel1_IRQHandler
.word DMA1_Channel2_IRQHandler
.word DMA1_Channel3_IRQHandler
.word DMA1_Channel4_IRQHandler
.word DMA1_Channel5_IRQHandler
.word DMA1_Channel6_IRQHandler
.word DMA1_Channel7_IRQHandler
.word ADC1_2_IRQHandler
.word CAN1_TX_IRQHandler
.word CAN1_RX0_IRQHandler
.word CAN1_RX1_IRQHandler
.word CAN1_SCE_IRQHandler
Or, as a workaround, put
#define DMA1_Channel7_IRQHandler DMA1_CH7_IRQHandlerin a USER CODE block at the top of the *_it.c file.
2026-03-20 6:07 AM - edited 2026-03-20 6:08 AM
It appears this bug has been fixed. The code generates correctly on the latest STM32CubeMX version. Update your STM32CubeMX to fix this.
.word EXTI0_IRQHandler
.word EXTI1_IRQHandler
.word EXTI2_IRQHandler
.word EXTI3_IRQHandler
.word EXTI4_IRQHandler
.word DMA1_Channel1_IRQHandler
.word DMA1_Channel2_IRQHandler
.word DMA1_Channel3_IRQHandler
.word DMA1_Channel4_IRQHandler
.word DMA1_Channel5_IRQHandler
.word DMA1_Channel6_IRQHandler
.word DMA1_Channel7_IRQHandler
.word ADC1_2_IRQHandler
.word CAN1_TX_IRQHandler
.word CAN1_RX0_IRQHandler
.word CAN1_RX1_IRQHandler
.word CAN1_SCE_IRQHandler
Or, as a workaround, put
#define DMA1_Channel7_IRQHandler DMA1_CH7_IRQHandlerin a USER CODE block at the top of the *_it.c file.