cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE generates wrong peripheral init sequence when using DMA

Ben K
Senior III

Hi there!

I have configured an STM32L432KC Nucleo board in STM32CubeIDE, with UART2 and TIM2 using DMA. The generated code doesn't set up these DMAs correctly. The root cause is that their MX_<peripheral>_Init() calls precede the MX_DMA1_Init(), and the MspInit() of these two peripherals initialize DMA channels at a time when the RCC clock for the DMA isn't enabled. The project setup is available here for reproducing the problem: https://github.com/benedekkupper/ProntoInfrared/tree/bc8280e38ce5fb5fe04d3c918bf8fa2542a05964

1 ACCEPTED SOLUTION

Accepted Solutions
Louis Cloete
Associate III

This was fixed and regressed recently again. See https://community.st.com/s/question/0D50X0000Bmob3uSQA/dma-not-working-in-cubemx-generated-code-order-of-initialization

In the mean time, you can reorder the functions in CubeMX. See UM1718 STM32CubeMX for STM32 configuration and initialization C code generation section 4.9.3 Advanced Settings Tab: Ordering initialization function calls on page 139.

View solution in original post

2 REPLIES 2
Amel NASRI
ST Employee

Hi @Ben K​ ,

Thanks for sharing your experience.

Unfortunately, this is a known issue faced with STM32CubeMX 6.3.

Our STM32CubeMX team is already aware about it. A fix should be available in next revision of the tool (we expect it to be available soon).

-Amel

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.

Louis Cloete
Associate III

This was fixed and regressed recently again. See https://community.st.com/s/question/0D50X0000Bmob3uSQA/dma-not-working-in-cubemx-generated-code-order-of-initialization

In the mean time, you can reorder the functions in CubeMX. See UM1718 STM32CubeMX for STM32 configuration and initialization C code generation section 4.9.3 Advanced Settings Tab: Ordering initialization function calls on page 139.