2016-07-20 06:31 AM
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 Martin2016-07-20 06:44 AM
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?2016-07-26 12:02 AM
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 Martin2016-07-26 03:05 AM
Ok, I tried it. Using DMA_ISR.TCIFx works fine.
Martin2016-07-26 04:36 AM
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.