Skip to main content
damasosb
Associate
April 10, 2015
Question

ADC using DMA

  • April 10, 2015
  • 3 replies
  • 820 views
Posted on April 10, 2015 at 12:25

I'm using a stm32f429 running at 144MHz and I wanted to implement a periodic two-channel adc conversion. I need to make the conversions on a 1us period and I'm considering in using a dma adc conversion.

I know how to make a continuous conversion using dma, but not a periodic one.

If the conversion period was longer, I would use a timer interrupt to make a one-shot dma conversion, but been it a 1us period, I doubt the system can work at such speed.

Can someone please give me some insight on the matter?
    This topic has been closed for replies.

    3 replies

    raptorhal2
    Lead
    April 11, 2015
    Posted on April 11, 2015 at 17:54

    A timer trigger to ADC1 which then also starts ADC2 in dual mode will probably solve the 1 us conversion requirement, and DMA can stuff the results in a RAM buffer. If this is continuous sampling, then your challenge is to process the results fast enough. If everything can be saved in a RAM buffer first, that is more do-able.

    If this is a Disco board, use channels 5 and 13.

    Cheers, Hal

    damasosb
    damasosbAuthor
    Associate
    April 15, 2015
    Posted on April 15, 2015 at 09:36

    I'm not sure if I understand what you are explaining to me. I should use a 1us timed interrupt that start an adc dual conversion using adc1 and adc2, is that it? I only plan to maintain this mode of operation during 15ms, so the results will be stored in a ram buffer and processed later, so that's why I'm planning to use the dma.

    Could you please give me an example of configuration of the adcs and dma for this behaviour? I've never used the adc in dma dual mode, so I'm a bit lost here. Thanks in advance

    raptorhal2
    Lead
    April 15, 2015
    Posted on April 15, 2015 at 16:08

    It looks do-able.

    First refresh you memory with the F4xxx Reference Manual:

    Section 13.3 ADC Block Diagram identifies which timers have an ADC trigger

    Section 13.6 discusses external trigger

    Section 13.8.1 discusses using the DMA

    Section 13.9 discusses Multi-ADC mode

    Section 10.3.3 identifies DMA channel and stream selection

    Then the Standard Peripheral Library has an example of ADC Dual Mode Regular Simultaneous conversion. It may need some adapting for your application. The Hal library may also have something, but I am not familiar with that.

    Cheers, Hal