cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F3 ADC with DMA Bug?

BobC_4199
Associate

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.

3 REPLIES 3
STOne-32
ST Employee

@Imen DAHMEN​ 

Imen.D
ST Employee

Hello @BobC_4199​ ,

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

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

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?