0
votes
  1. If I disable DMAContinuousRequests, does the ADC automatically trigger a DMA request every time it finishes a conversion?
  2. What if I enable DMAContinousRequests, does the DMA transfer a sample of the adc multiple times if there was no new conversion inbetween ?

This is what the manual says:

"[...] this parameter specifies whether the DMA requests are performed in one shot mode (DMA transfer stops when number of conversions is reached) or are performed in continuous mode (DMA transfer unlimited, whatever number of conversions)."

What I want to do

I want to watch the input for an edge that exceeds a threshold. If I detect one I want to save the next X samples to memory via the DMA with a samplerate of Y samples/s.

(for example: X = 64 and Y = 10k)

My idea

  1. setup a analog watchdog
  2. when the threshold is exceeded use the callback to set the ADC to DMA-mode and trigger it with a timer (Continous Converion Mode disabled and DMAContinousRequests disabled)
  3. switch back to watchdog-mode after X samples (DMA buffer full)

Back to the question

Is my Continous Converion Mode and DMA Continous Requests setting, correct for this purpous ?

1

1 Answers

0
votes

Continuous mode means that it after it has converted each enabled channel once it starts again with the first one, instead of stopping.

Either way the DMA is requested to transfer the data only when it is ready.

[Edit for new question]

As I read the manual the ADC has only two DMA modes: in continuous mode it will go forever. In non-continuous it will convert each enabled channel only once.

If you you want to read the same channel more than once but not forever then you need to enable continuous DMA mode to begin with and then turn it off at some point in the future. Probably the DMA complete interrupt will be suitable for that.