cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX calls generated init functions for DMA and USART in a wrong sequence

VErma.1
Associate

If you generate code in CubeMX with enabled USART and DMA for TX line init functions will be called in a wrong sequence. Init function for USART is called before DMA init function but it does some setup for DMA. Since DMA init function enables bus clock that relates to DMA then all settings that were made in USART init function for DMA will be missed (all DMA register will be 0).

It works for CubeMX 5.4.0 and STM32L4 Discovery board.

1 REPLY 1

It's a known problem with v 5.4

https://community.st.com/s/question/0D50X0000Bmob3uSQA/dma-not-working-in-cubemx-generated-code-order-of-initialization

Generating a new project in New version may generate the correct order, but existing projects probably won't get corrected automatically and there are issues reported with manual reordering https://community.st.com/s/question/0D50X0000CAthwBSQR/stm32cubemx-56-generated-function-calls-ranking-not-working-correctly

I don't use Cube/CubeMX.

JW