cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX bug? MX_DMA_Init() called in the wrong order.

MSipo
Senior II

I'm setting up the DMA to move received bytes from USART3 to a circular buffer.

But the DMA don't move the received data to the buffer.

The received data is received by USART3 (The DR contains the received byte and SR.RXNE is set to 1).

All I need to do to make it work is to edit in main.c. I move the call to MX_DMA_Init() to be called before MX_USART3_UART_Init().

Is this a STM32CubeMX bug?

/* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();    // I moved MX_DMA_Init() up here. Then it works.
  MX_USART3_UART_Init();
  MX_TIM1_Init();
  //MX_DMA_Init(); // DMA don't work if we call MX_DMA_Init() here
  MX_DAC_Init();
  MX_TIM14_Init();
  MX_ADC1_Init();
  MX_SPI3_Init();
  MX_CRC_Init();
  MX_I2C1_Init();
  /* USER CODE BEGIN 2 */

3 REPLIES 3
Ghofrane GSOURI
ST Employee

Hello @Community member​ 

First let me thank you for posting

Actually this issue is resolved in the latest version of CubeMX 6.7.0

Please try to download the latest version from this LINK

0693W00000WKevoQAD.png

Thx

Ghofrane

I have the latest version. The problem was one line in the ioc file that was inherited. I found the solution here : https://community.st.com/s/question/0D53W00001EzCmCSAV/mxdmainit-order-in-the-mainc-file-generated-by-stm32cubemx-how-to-fix

Semer CHERNI
ST Employee

Hello @Community member​ 

You are right, this is a known issue with older version of CubeMx. But as my colleague @Ghofrane GSOURI​ have said, it should be fixed with the 6.7.0 release and I am not able to reproduce this behavior.

To help us push further the investigation, could you please provide the part number of the MCU you are using. And if possible an *.ioc file that contain the issue.

Kind regards,

Semer.

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.