AnsweredAssumed Answered

KL25Z ADC hardware triggering with DMA

Question asked by aloblaw on Dec 11, 2015
Latest reply on Dec 18, 2015 by aloblaw

Hi,

 

I am a bit of a newcommer to Kinetis devices. Been playing with this project for a while and have had relatively little success.

 

Here are my basic requirements:

-sample 4 ADC inputs at >= 2kHz each (so 8kHz sampling speed total)

-send those values over USB for data logging (I am grabbing the values and writing them values to a .csv file in a Python script)

 

I found an interesting example online for PIT triggering the ADC, which stores the value in a buffer:

PIT- ADC- DMA Example for FRDM-KL25z, FRDM-K64F, TWR-K60D100 and TWR-K70

 

This example is great except when I crank up the speed of the PIT to 1us interrupts (i.e. PIT_LDVAL0 = 0x14), the program spends all of it's time in the interrupt routines. I am worried the interrupt is going to eat up all of the clock cycles and leave no time to do anything else.

 

What I need is a way to set up the ADC to convert values as fast as possible, and transfer at KNOWN periodic intervals (via DMA) to the UART (or a buffer). All of this should take place in the background so the CPU is not used at all. So far I cannot find a way to do that, as an interrupt seems to be required in both the PIT and the DMA.

 

Any recommendations are appreciated.

Outcomes