ADC with external sync source

Status
Not open for further replies.

uutzinger

Member
The example for ADC with external signal https://www.pjrc.com/teensy/adc.html seems to be for Teensy 1.0 and 2.0.
Are there examples for Teensy 3.x?

The ADC library by pedvide does not seem to have option to acquire signals with external synchronization either.

I am looking for some advice how to go about working through the documentation and implementing externally triggered ADC.

My goal is to improve the code examples for the C12880ma spectrometer which provides a trigger signal for reading each spectral channel. The example software for that micro spectrometer does not take advantage of trigger signals. Ideally the ADC runs at >=200k/S/sec.

Urs Utzinger
 
The simplest way is probably to write an interrupt handler to trigger a ADC conversion and to attach this to a GPIO pin interrupt. I’d try that out first to see if this meets your requirements in terms of latency and precision.
 
The simplest way is probably to write an interrupt handler to trigger a ADC conversion and to attach this to a GPIO pin interrupt. I’d try that out first to see if this meets your requirements in terms of latency and precision.

I am looking at https://www.pjrc.com/teensy/K20P64M72SF1RM.pdf and it says in chapter "31.3.6 Status and Control Register 2 (ADCx_SC2)" there is a hardware trigger option.

The Audio library for the teensy uses the PDB (timer) as hardware trigger source for 41kHz sampling and maybe extending the ADC library to use hardware trigger similar to audio library would be most useful.

I understand there is also DMA functionality and one can enable an interrupt that handles a ring buffer after each conversion.

I understand that is not the fastest way to go about this but it appears to me it would result in minimal latency and functionality similar to something like the National Instruments USB 6003 device that costs about $500.-.
 
The DMA ring buffer solution is for sure the most precise and elegant way. But it requires some experience and studying/understanding the source code of the audio lib. That's why I suggested to start with a simple pin interrupt handler to have an immediately working solution which can be refined later.
 
@manitou Thank you for sharing. I tested your lptmr code and added DMA. The issues I am having is that it looks like I need twice the desired frequency on the lptmr pin. In my setup the external ADC sync signal is generated by the sensor and I can not double its frequency.
 
Status
Not open for further replies.
Back
Top