Skip to main content
DavidAlfa
Senior II
May 6, 2022
Question

Timer + DMA: CubeMX inits Timer (And DMA stream in HAL_TIM_Base_MspInit) before DMA peripheral.

  • May 6, 2022
  • 1 reply
  • 921 views

CubeMX 6.5.0, CubeIDE 1.9.0

No matter what I do, CubeMX always generates this:

/* Initialize all configured peripherals */
 MX_GPIO_Init();
 MX_TIM2_Init();
 MX_DMA_Init();
 MX_TIM3_Init();

While it should be:

/* Initialize all configured peripherals */
 MX_GPIO_Init();
 MX_DMA_Init(); // <-- DMA first!!
 MX_TIM2_Init();
 MX_TIM3_Init();

So DMA fails miserably.

Attached the ioc.

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
May 6, 2022

This is an old known problem recurring for years.

https://community.st.com/s/question/0D53W00001EzCmCSAV/mxdmainit-order-in-the-mainc-file-generated-by-stm32cubemx-how-to-fix

Perhaps a good warning point to consider abandoning clicking in favour of normal programming .

JW