cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect DMA Interrupt Handler Generated for STM32C091xx (LL-Driver)

Kadir
Associate II

Environment Details

  • Microcontroller: STM32C091CBTx (LQFP48)
  • STM32CubeMX Version: 6.14.1
  • LL-Driver
  1. Configuration: An STM32CubeMX project is configured for an STM32C091CBTx MCU, with DMA channel 6 assigned to a peripheral (ADC).
  2. Generated Code (stm32c0xx_it.c): Upon code generation, CubeMX creates the shared interrupt handler for DMA channels 4, 5, 6, and 7 in the stm32c0xx_it.c file. The function is defined as:
    void DMAMUX1_DMA1_CH4_5_6_7_IRQHandler(void)
  3. Startup File Vector Table (startup_stm32c091xx.s): However, the default startup file provided with the project contains an incorrect entry for this interrupt vector. The handler name in the vector table is listed as:
    DMAMUX_DMA1CH4_5_IRQHandler

Consequently, the `DMAMUX1_DMA1_CH4_5_6_7_IRQHandler` function is never invoked when an attempt is made to trigger DMA Channel 6.

Confirmed Workaround

The issue can be resolved by manually editing the startup file:

  1. In the `startup_stm32c091xx.s` file,
  2. Search for the incorrect vector name: `DMAMUX_DMA1CH4_5_IRQHandler`.
  3. Rename it to `DMAMUX1_DMA1_CH4_5_6_7_IRQHandler`.

Following this modification, the DMA interrupt for channel 6 is successfully triggered and handled by the ISR.

1 ACCEPTED SOLUTION

Accepted Solutions
Ghofrane GSOURI
ST Employee

Hello @Kadir 

Your contribution is greatly appreciated.

The issue has been escalated to the development team for resolution. The internal ticket number is 214319  .

I will keep you posted with updates.

THX

Ghofrane

 

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.

View solution in original post

5 REPLIES 5
Ghofrane GSOURI
ST Employee

Hello @Kadir 

I'm currently investigating this issue.

I will get back to you asap

THX

Ghofrane

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.

Ghofrane GSOURI
ST Employee

Hello @Kadir 

Your contribution is greatly appreciated.

The issue has been escalated to the development team for resolution. The internal ticket number is 214319  .

I will keep you posted with updates.

THX

Ghofrane

 

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.

Hello the bug is still here, I drop here the repport

Title: STM32CubeMX generates incorrect DMA IRQ handler name for STM32C091xx (DMAMUX1_DMA1_CH4_5_6_7 vs CH4_5)

Component/Tool: STM32CubeMX (code generation)

MCU: STM32C091KBT6 (STM32C0 family)

FW Package: STM32Cube FW_C0 V1.4.0

Existing community report: https://community.st.com/t5/stm32cubemx-mcus/incorrect-dma-interrupt-handler-generated-for-stm32c091xx-ll/td-p/823392

Description:

STM32CubeMX generates an incorrect DMA interrupt handler name in stm32c0xx_it.c and stm32c0xx_it.h for the STM32C091xx target.

Generated code (incorrect):

// In stm32c0xx_it.c / stm32c0xx_it.h
void DMAMUX1_DMA1_CH4_5_6_7_IRQHandler(void)

Startup vector table (correct symbol):

// In startup_stm32c091kbtx.s (provided by ST)
.word DMAMUX1_DMA1_CH4_5_IRQHandler

The handler name DMAMUX1_DMA1_CH4_5_6_7_IRQHandler generated by CubeMX does not match the symbol DMAMUX1_DMA1_CH4_5_IRQHandler defined in the startup file startup_stm32c091kbtx.s. Since the startup file declares this symbol as weak aliased to Default_Handler, the linker silently resolves the interrupt vector to Default_Handler (an infinite loop) instead of the user's ISR.

Root cause analysis:

The STM32C091 has DMA1 channels 1-5 (not 1-7 like larger STM32C0 variants). The startup vector table correctly uses DMAMUX1_DMA1_CH4_5_IRQHandler, but CubeMX code generation uses the name from a larger variant (CH4_5_6_7), creating a mismatch. This appears to be a device variant mapping error in CubeMX's code generation templates.

Impact: Any DMA transfer on channels 4-5 (e.g., USART4 RX DMA in our case) triggers Default_Handler instead of the correct ISR, causing a hard crash (infinite loop). This is a silent failure — the code compiles and links without any warning or error because the weak attribute masks the mismatch.

Regression behavior: This bug is reintroduced on every CubeMX code regeneration, since CubeMX overwrites stm32c0xx_it.c and stm32c0xx_it.h outside of USER CODE sections. This forces developers to manually patch the handler name after every regeneration, which is error-prone and defeats the purpose of the code generator.

Workaround: Manually rename DMAMUX1_DMA1_CH4_5_6_7_IRQHandler to DMAMUX1_DMA1_CH4_5_IRQHandler in both stm32c0xx_it.c and stm32c0xx_it.h after each CubeMX regeneration.

Steps to reproduce:
1. Create a new STM32CubeMX project for STM32C091KBT6
2. Enable DMA on any peripheral using DMA1 channel 4 or 5 (e.g., USART4 RX)
3. Generate code
4. Compare the handler name in stm32c0xx_it.c with the vector table in startup_stm32c091kbtx.s
5. Observe the mismatch: DMAMUX1_DMA1_CH4_5_6_7_IRQHandler vs DMAMUX1_DMA1_CH4_5_IRQHandler

Expected fix: CubeMX should generate DMAMUX1_DMA1_CH4_5_IRQHandler (matching the startup vector table) for STM32C091xx targets.


Edited to apply source code formatting - please see How to insert source code for future reference.

Hello @Noëlie_Jestin 

Ticket 214319 has not been implemented yet; it will be fixed as soon as possible.

I will keep you posted with updates.

THX

Ghofrane

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.

Thanks! This is good to know (it was very tricky to find the bug ^^")