Showing results for 
Search instead for 
Did you mean: 

STM32F303R8T6 - ADC + DMA not working

Associate II

Hello Team ST,


I am working on ADC setup using DMA, where upon the conversion completion the ADC values shall be transfered to memory using DMA. The ADC and DMA configurations are as shown in snap below.


The DMA settings are as follows.


The initialization sequence and the ADC start code is as below, where AINW_DmaRawAdcData is "uint32_t AINW_DmaRawAdcData[2];"


I am using STM32CubeMx version 6.10.0 and STM32F3 Software Pack version 1.11.4.


When I run the code, the values in buffer AINW_DmaRawAdcData are zero and the DMA interrupt "DMA1_Channel2_IRQHandler"  in not getting triggered. When I try to read ADC values using HAL_ADC_GetValue, the values getting updated. However the ADC + DMA combination is not working.


Please help me to resolve the issue. Let me know in case any additional information is needed.


Associate II


Did you enable the DMA interrupt in the NVIC settings? (in the ioc) 

I never used the HAL_ADC_Start_DMA, but are you sure that the source (ADC->DR) and target addresses are set correctly? 
It's strange, that HAL_ADC_Start_DMA uses uint32_t - the register is 32 bit but only the lower 16bit are "read bits" - I would propose to configure the DMA as half word. 

Associate II

Hello @stryga ,


Thank you for the reply.


The DMA interrupt is enabled in NVIC setting. I checked the implementation the SA and DA are set correctly but somehow it appears that the DMA is not getting triggered.

I believe as the ADC value and DMA register are 32 bit words so a word transfer will also work there. However, I have tried with half word as well but still not working. 


Data width should be half-word.

Initialize the buffer with values and see if it's overwritten.

After the transfer fails to work, look at the values in the DMA1 channel 2 registers to see if it's marked as complete.

> the DMA interrupt "DMA1_Channel2_IRQHandler"  in not getting triggered

How are you determining this exactly?

If you feel a post has answered your question, please click "Accept as Solution".
Associate II



As mentioned tried with half word data width and verified the registers using DMA request polling function "HAL_DMA_PollForTransfer".

After initiating the transfer the contents of hdma->DmaBaseAddress->ISR register remains zero.

The buffer values are initialized with some values, they remain the same.

> the DMA interrupt "DMA1_Channel2_IRQHandler"  in not getting triggered

By adding breakpoint in the function.