DSP with Arduino Due... will this work?

I am considering an Arduino Due for the below application. I have no experience with it, but I think the Due should be able to do this. Do you agree?

  1. Wait for a GPIO input signal to start.
  2. Be ready to receive a different GPIO input signal to immediately cancel the operation at any time.
  3. Upon receiving the start signal…
  4. Read the Due’s ADC at 5 microsecond intervals for 100 milliseconds (store 20,000 12-bit samples as “Set A”), and then immediately after at 1 millisecond intervals until 10 consecutive values of the data are below threshold X, for a maximum of 20 seconds (store up to 20,000 12-bit samples as “Set B”).
  5. Get the time elapsed between the first 10 consecutive samples of Set A above threshold X and the first 10 consecutive samples of Set B below threshold X, with an accuracy better than 2 milliseconds.
  6. Get the peak value of the data of Set A while applying a 4 point moving average low-pass filter.
  7. Get the average value of the data of Set B, excluding the last 10 samples.

The most important issue you missed altogether is what kind of sample rate jitter can you tolerate? With any ARM processor, you will not get an absolute 5us sample rate without some serious work.

Now, for the bad news. The Due ADC is too slow to achieve those speeds without some software changes. I read you can get to 500KHz plus with some work, details are out there on the web. Never needed to do it so I cannot say if and how well it works.

If I was tasked with your outline, I’d seriously consider going with the Teensy 3.5/3.6. It’s a far better solution and the ADC will function at the required speeds. But, you still have the issue of ARM processor timing but you’ll find excellent support for the Teensy boards on their own dedicated forum. It’s not that the Due is a bad board but the Teensy is so much better from a library and code development standpoint.

All measurements you want to do can be easily performed by a DUE.

You can log ADC conversions at 200 KHz for 100 ms in BufferA (20000 12-bit samples = 40000 bytes), log another ADC conversions at 1 KHz for 20 seconds in BufferB (20000 12-bit samples = 40000 bytes), store a total of 80000 bytes (the DUE SRAM = 96 KBytes).

Then parse and/or average the ADC samplings as you want. You will have a good accuracy because you know exactly when a sample has been done from its position in its buffer.

FYI, you can sample an ADC channel up to 1 Msps.

There are lots of example sketches for ADC direct register programming in the DUE sub forum.

Edit: FYI the DUE is still for sale in the arduino product line on this site:

Ordinary levels of processor jitter are of no concern because the only results that interest me are the peak of Set A, the average of Set B and the elapsed time accurate to 2 ms. In the research I did after posting this, I saw that the Due had been discontinued. So, I looked for alternatives and discovered the Teensy 3.6. Wow! The suggestion from WattsThat helps validate my decision to pursue this on the Teensy. Thanks all.