cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L1xx ADC EOC when using DMA

mmensch
Associate II
Posted on July 20, 2016 at 15:31

Hello,

I use STM32L1xx ADC in scan mode with DMA with these settings:

ADC_CR1_SCAN set

ADC_CR2_CONT cleared

ADC_CR2_DDS and ADC_CR2_DMA set

ADC_CR2_EOCS cleared

I scan 4 channels after trigerering with ADC_CR2_SWSTART. Next scan is also started by just setting ADC_CR2_SWSTART.

Should I get ADC_SR_EOC set after the last conversion of the scan is done and data are stored in memory? For me it remains cleared. How else can I determine end of scan?

Thanks

Martin

4 REPLIES 4
Posted on July 20, 2016 at 15:44

Wouldn't the DMA reading the ADC->DR be expected to clear it?

Why can't you use the DMA TC or HT to signal the completion of all conversions?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mmensch
Associate II
Posted on July 26, 2016 at 09:02

Hi Clive,

sorry for the delay...

> Wouldn't the DMA reading the ADC->DR be expected to clear it?

I read the ref manual up and down but couldn't find a clear statement on this. It says that EOC is cleared by reading ADC->DR but not if this is true also for using DMA.

> Why can't you use the DMA TC or HT to signal the completion of all conversions?

That is a good idea, I will try it.

Thanks

Martin

mmensch
Associate II
Posted on July 26, 2016 at 12:05

Ok, I tried it. Using DMA_ISR.TCIFx works fine.

Martin

Posted on July 26, 2016 at 13:36

I read the ref manual up and down but couldn't find a clear statement on this. It says that EOC is cleared by reading ADC->DR but not if this is true also for using DMA.

In IC Design one wants to do things in the least complicated and convoluted manner possible. The peripheral does not differentiate the source of bus interactions, so a read action on an address (ADC->DR) is going to behave materially the same whether it comes from the CPU or DMA unit. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..