Skip to main content
BobC_4199
Associate
November 24, 2019
Question

STM32F3 ADC with DMA Bug?

  • November 24, 2019
  • 2 replies
  • 2037 views

STM32CubeIDE with STM32F3 HAL Library version 1.11.0.

Using HAL library to set up timer (TIM6) driven ADC (ADC1) trigger with DMA (DMA1) capture. DMA does not configure correctly.

The Cube Generated code in main.c configures the hardware as:

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_RTC_Init();

 MX_TIM6_Init();

 MX_USART3_UART_Init();

 MX_USB_PCD_Init();

 MX_ADC1_Init();

 MX_DMA_Init();

 /* USER CODE BEGIN 2 */

Unfortunately this is problematic because MX_ADC1_Init() code configures the CCR DMA register. These writes are ignored because the DMA has not be initialized and its clock is off. DMA behaves as if all the CCR bits are Zero. Quick fix is to exchange the order of MX_ADC_Init() and MX_DMA_Init(). A more permanent fix is to place a call to MX_DMA_init(); is the user code section prior to the Cube generated code so that when the code is regenerated, the DMA is initialized before the ADC.

This topic has been closed for replies.

2 replies

STOne-32
ST Technical Moderator
November 25, 2019

@Imen DAHMEN​ 

ST Technical Moderator
November 26, 2019

Hello @BobC_4199​ ,

This is a known isssue reported internally and will be fixed in the coming release of STM32CubeMx.

Best Regards,

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
BobC_4199
BobC_4199Author
Associate
November 26, 2019

Thank you. I tried to reproduce the problem on a separate instance of STMCubeIDE on another computer and the initialization sequence was correct.

Is there a place to see the bug/issue list?