Teensy 4.0 DMA ADC

Status
Not open for further replies.
Hello!

Can you use DMA to sample from the ADC of a teensy 4.0 at a set sampling period without having to have your code hand during the period between samples, and if so does anyone have any sample code of this on a 4.0? Here is my sampling as it is:

Code:
for (int i = 0; i < samples1; i++)
    {
        useconds_sampling1 = micros();
        int value = analogRead(A8) - 130;
        vReal1[i] = value;

        while (micros() < (useconds_sampling1 + sampling_period_us1))
        {
            //wait...
        }
    }
and then I later sample again at a different sampling period. As the number of samples grows, the time spent waiting on samples is starting to grow and really slow down my program. Any help on this would be greatly appreciated!
 
You might try ADC library,
And then you might look at the example sketch adc_timer_dma
 
What should I do to get the adc_timer_dma working with Teensy 4.0?

It is very confusing the same example is for
On Teensy 3.x this uses the PDB timer.

On Teensy 4, this uses one or two of the unused QTimers.
How do I tel I have Teensy 4.0?
 
Status
Not open for further replies.
Back
Top