adc & dma
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2009-12-31 2:27 AM
Posted on December 31, 2009 at 11:27
adc & dma
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:36 AM
Posted on May 17, 2011 at 13:36
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?Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:36 AM
Posted on May 17, 2011 at 13:36
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.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:36 AM
Posted on May 17, 2011 at 13:36
ok, thanks for the answer. :D
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:36 AM
Posted on May 17, 2011 at 13:36
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.