@mjs513, @PaulStoffregen @manitou, ...
Thought I would see how hard it is to do ADC using DMA at some specific sampling rate, Example for trying to guess if an power is running to a well pump, so with T3.6 I setup to read at 3000 samples per second(So get 50 samples per AC cycle...)...
This use ADC with PDB and DMA...
Should be a piece of cake...
Not sure yet I may try simpler version first of simply try to put in the DMA support. I know that @manitou has a sketch... Should hopefully not be heard to adapt ...
But to do the conversions at a specific time, my Nth pass through document, and now seeing @manitou other example sketch, I believe that, to do this,
You need something like:
a) PIT timer which sets up to timing stuff for you
b) an ADC_ETC (External Trigger Control) that you setup one of them that is configured to point to your ADC number and channel and ADC using the ADC_ETC as it's channel.
c) XBAR1 setup where you setup to MAP from the PIT timer you choose to map the PIT timer to the ADC_ETC object
...
Easy... What could go wrong
Especially with simple things like in the example sketch: xbar_connect(56, 103); // pit to adc_etc
You start off saying WTF... what is 56 and 103?
First 56 which from sketch I know is some form of INPUT and 103 some form of output.
It you look at Table 3-4 (Page 62) We find that:
So it is a trigger from PIT...
Likewise 103 - Table 3-7, (page 70)
Code:
XBAR1_OUT103 ADC_ETC_TRIG00
So it is setup to be ETC Trigger 0...
Next question is, is there some place that these magic numbers are defined? And/Or should they be?
i.e. should be be some either #defines and/or enum declares like:
Code:
#define XBAR1_IN_PIT_TRIGGER0 56
#define XBAR1_OUT_ADC_ETC_TRIG00 103
If so should these be part of imxrt.h?
Or would the be part of enum/class or like so instead of above you might be XBAR1_IN:
IT_TRIGGER0 ?
Also there are probably a lot more magic numbers to decode here as well!
Just wondering... Also I do very much appreciate all of these examples! THANKS!