KL05 linked DMA channels

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KL05 linked DMA channels

688 Views
RobertoCW
Contributor I

I'm developing a FW used to "play" a particular waveform (a kind of 40KHz sine wave) on DAC0 output.

I use a KL05 32KFlash 48MHz processor. I would like to implement a linked DMA approach in order to keep as stable as possible

the output waveform and keep the use of CPU core as low as possible. I've created 4 const array with 1024 samples (16bit each sample).

I would like to start the waveform generation with DMA0 which generates an interrupt at the end of the whole array transfer

and at same time generates the trigger signal for the DMA1 channel. DMA1 channel "plays" the second array and at the end of

the whole array transfer triggers the DMA0 activity. This sequence must be repeated for a specific number of times.

All the DMA activities must be timed by PIT (or TPM1) in order to play the samples at the right rate.

How can I program the DMA channels in order to be activated by the hw trigger sources (DMA channels and timer) in the right sequence?

The interrupt service routines has to be as shorter as possible because each delay/latency becomes an output waveform distortion.

Thanks for any suggestion.


Labels (1)
0 Kudos
2 Replies

364 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi ,

I think it is easy to implement, but from my point of view, there is only one DMA channel needed. You may use a PIT to trigger DMA(cycle steal must be enabled to force one transfer per trigger), and the source can be the integration of the 4 const array with 1024 samples (16bit each sample), and the destination can be the DAC0 data register, the source buffer can be set as a circular buffer so that MCU needn't adjust the source address, the only thing the core has to do is resetting the byte number to be transferred after the whole DMA is done. This can be done in the DMA interrupt.

Hope that helps,

B.R

Kan

0 Kudos

364 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

I am investigating this and it might take some time, and will let you know when I have any progress, Thanks for your patience!!

B.R

Kan