cancel
Showing results for 
Search instead for 
Did you mean: 

Question on ADC with DMA circular mode

Hoang Phuc
Associate II
Posted on February 06, 2017 at 19:12

Hi everyone,

I'm a newbie and I'm working on ADC with DMA in circular mode like pictures below:

0690X00000606FvQAI.png0690X00000606FzQAI.png

and a part of my code is:

HAL_ADC_Start_DMA(&hadc1,(uint32_t*)buffer,sizeof(buffer));

while(1){

for(i=0;i<=255;i){}

}

When I debug with STM Studio and also in practical, I found that DMA in Circular mode become a loop, which mean the code cannot go in the while loop, it just keep reading continuous the ADC value. But when i change DMA to Normal mode, the DMA code read one time and go to the while loop (this is right). I think that the circular mode must update the ADC value continuously when the while loop running and we can use that ADC value to process in the while loop. 

I'm I right? I watched videos and read very much but I can't find the solution for my issue.

Please help me everyone!

Thanks

1 REPLY 1
T J
Lead
Posted on February 07, 2017 at 21:43

I made it work seamlessly, please check the discussion:

https://community.st.com/0D50X00009XkYJTSA3