Reading linear sensor array, TSL201R-LF: ADC with interrupt routine and DMA?

Are there any resources or open source projects that use the Arduino Due Atmel SAM3X8E ARM Cortex-M3 CPU’s ADC with an interrupt routine to read a photodiode array IC, or any kind of external IC with a PWM output array?

Specifically, I am using the TSL201R-LF linear sensor array, which requires three things:

  • An input clock between 5 - 5000 kHz always running
  • A serial input that pulses once at the clock rate to start/stop data transfer from the IC (64 bits) to the receiver
  • An analog input pin on the receiver, where the TSL201R-LF sends 64 clock pulses of data

For the Arduino UNO Atmega, there exists a project doing exactly this , and even a library, however the architecture is very different between the two CPUs, and code that depends on the AVR library does not compile with LibSAM.

I have tried hardcoding a software clock with the Due with delays as previously done here and here, however the sensor outputs either a maximum 1023 value or nonsensical numbers: testing the voltage on the output pin does not produce the required 2-3.4V as specified in the data sheet. Furthermore, using the ADC with an interrupt routine would allow for multiple TSL201R-LF’s to be used with a single Arduino Due.

This short tutorial uses a ADC with DMA for temporary data storage, but I could not configure the correct trigger input pulse for the serial input pin. To reiterate: are there any existing projects or code snippets that use the Arduino Due ADC with interrupts and DMA for storage of PWM data arrays?

See this thread for ADC sampling programming (reply #1), then add a PDC DMA to log data:

https://forum.arduino.cc/index.php?topic=487989.0

ard_newbie, thanks for the reply. Is it possible to generate a single clock high pulse every n-th clock pulse outside of the loop() function? This is required to trigger the photodiode chip to begin reading out values. Also, how would I buffer the output? Instead of a single value, the chip streams an array of 64 values sequentially for 64 pulses following the trigger pulse.

yosyp:
Is it possible to generate a single clock high pulse every n-th clock pulse outside of the loop() function?

You can do this with a interrupt triggered by a timer counter.

yosyp:
how would I buffer the output? Instead of a single value, the chip streams an array of 64 values sequentially for 64 pulses following the trigger pulse.

You can store 64 samples in a 64 uint16_t buffer with a DMA.

You will find examples sketches in the DUE forum.