2009-12-31 02:27 AM
adc & dma
2011-05-17 04:36 AM
Hi, I've got an usual problem but I don't know which is the best way to solve it.
I am reading from one AD in a interrupt an form seven more in the main program, the problem is how I can avoid the overwriting of the ADC_DR register during the interrupt? because, as it is said in the manual there is just one ADC_DR register. Looking into it I've seen the DMA but as I am using one low-density micro I just as 7 DMA channels so that I can't save my 8 ADs. The question is DMA avoids the writing in the AC_DR register? Or it just copies its values in another register? How I could this problem?2011-05-17 04:36 AM
Hello bernat,
the ADC uses serial conversion of channels, thus needs only one DMA channel (DMA1_Channel1). Setup the DMA in circular mode, 2*8 items, and instead of ADC interrupt, use HalfTransfer and TransferComplete interrupts from this DMA unit. The results will be stored in an array of 16 items, each DMA interrupt will tell you that one half of the buffer is converted with new data. See ADC1_DMA example from firmware library, extend the ADCConvertedValue to an array [16], add more converted channels (8), configure DMA for 16 transfers and enable HT and TC.2011-05-17 04:36 AM
ok, thanks for the answer. :D
2011-05-17 04:36 AM
Hi bernat,
Using an injected channel for (ADC interrupt conversion)is a good condidate solution in your case. for other ADC conversions you can use regular channels with only one DMA channel transfer as stated by edison. Happy end of year for all.