AnsweredAssumed Answered

EDMA example code for ADC to buffer transfer using KSDK API calls?

Question asked by Marco Hess on Sep 4, 2014
Latest reply on Oct 24, 2014 by Maurice LAUZE

I am pretty new to the KDSK and the EDMA peripheral and its concepts on how it fits all together. It's a pretty steep learning curve.

 

What I need is:

  • Run both ADC0 and ADC1 in the K22 in parallel to sample two channels simultaneously at around 100kHz rate.
  • Transfer the ADC0 and ADC1 results to memory in blocks of 1024 samples for each ADC.
  • After a transfer to say buffers A0 and A1, flip to new buffers B0 and B1 and after that back to A0 and A1.
  • After each DMA block I need an interrupt that tells me which buffer has the latest data so I can process the data in the buffer (quadrature multiply into I & Q data, and FIR filter and decimate the I & Q).

 

I have the ADC's running with interrupts and triggered by the PDB on a slower rate, but now I need to get the ADC triggering the DMA and transfer into buffers.

 

So how do I set that up?  I am a bit lost in the KSDK API functions. The describe very well what all the parameters are but not in which order they need to be setup and how it all fits together.

 

So far I think I have a handle on:

  • EDMA_DRV_Init
  • EDMA_DRV_RequestChannel
  • EDMA_DRV_InstallCallback
  • EDMA_DRV_StartChannel

 

But how do I setup these transfer descriptors and links to do what I want?

 

Anybody can provide a few lines of a sample code or a pointer to sample code on how to do this using the KSDK API functions?

Outcomes