cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX USART1 with DMA, LL driver inits DMA streams before enabling DMA CLK

PÖste.1
Associate II

I have had a problem getting DMA TX for USART1 to work, no errors, stream gets enabled nut nothing is transferred, stream never complets. I am using LL driver for USART1.

I finally found the problem is that generated usart.c code inits DMA without enabling the CLK. Init of DMA is done after USART1. Eventually I found the "hidden" up/down arrows in CubeMX (scroll down the window) and could move call to MX_DMA_Init() up before other peripherals.

I am note sure if CubeMX is supposed to leave such detals to the user - I would not misssed it not using CubeMX but one assumes CubeMX has the brains to handle this dependency, or?

I have CubeMX 5.4.0 and STM32F413 MCU.

2 REPLIES 2
PHryn
Associate III

I can confirm this bug on stm32g4.

MX_DMA_Init should be right after MX_GPIO_Init.

Propably it can affect all cubemx dma code generator.

Regards,

Pawel

Amel NASRI
ST Employee

Hello,

Similar problems are already tracked in https://community.st.com/s/question/0D50X0000Bmob3uSQA.

The fix will be available in next STM32CubeMX release.

Best Regards,

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.