cancel
Showing results for 
Search instead for 
Did you mean: 

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

DavidAlfa
Senior II

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.

1 REPLY 1

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