cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX: ADC and DMA initialized in the wrong order

DWann
Associate III

STM32L010C6Tx

STM32CubeMX V 5.4.0

FW_L0 V1.11.2

When creating a new project that used the ADC with the DMA and some unrelated peripherals, cubeMX will generate the following initialization list in main:

  /* Initialize all configured peripherals */
  MX_ADC_Init();
  MX_DMA_Init();
  MX_TIM2_Init();
  MX_TIM21_Init();
  MX_GPIO_Init();
  /* USER CODE BEGIN 2 */

This is a bug - MX_DMA_Init() should be called before MX_ADC_Init(). The ADC init function will attempt to write the the DMA CCR1 register, but will fail because the DMA has not yet been initialized.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @DWann​ 

Please try with the last STM32CubeMX, it correct the issue.

Best regards,

Nesrine

View solution in original post

8 REPLIES 8

Hello @DWann​ 

Please try with the last STM32CubeMX, it correct the issue.

Best regards,

Nesrine

Ondre
Associate

Hello!

I've still encountered the same bug in STM32CubeIDE Version 1.7.0 for the STM32L100C6. It is however possible to change the initialization order manually inside the advanced settings.

Best regards

André

@Community member​ ,

Was this a new project, or you opened an older project with new version of CubeMX?

I understood that the problem was fixed some year ago, but the old .ioc files contain the order established by the old, buggy version of CubeMX.

JW

Ondre
Associate

Completely new (a few weeks old maybe) project from scratch, but I'll try again, just to be sure.

Stephen28
Associate III

I just burned a day figuring this one out.

This project was created about 2 months ago. STM32H743.

Ondre, thanks for the hint that I can change the order in CubeMX Advance Settings.

Robin Aproskie
Associate II

This is still a problem in CubeIDE 1.8.0 and FW_L0 1.12.1 took me 2 weeks to find the Issue.