Skip to main content
MSipo
December 9, 2022
Question

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

  • December 9, 2022
  • 2 replies
  • 1764 views

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 */

This topic has been closed for replies.

2 replies

Ghofrane GSOURI
December 9, 2022

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

MSipo
MSipoAuthor
December 9, 2022

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
December 20, 2022

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.