DMA as double buffer

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

DMA as double buffer

Jump to solution
1,306 Views
wendersonolivei
Contributor IV

Hi All,

I'm writing a code to output sound tones on DAC, with DMA. Due to precision that I need on tones, I need to use a dual buffer to process and output data via DMA (ping pong buffer).

Well, I've tried to process data and change the source address at DMA OnComplete event, but I haven't enough time to process all data. In some DMAs, we have a hardware trigger to do ping pong buffer; the DMA present in KL25Z can do that?

Thanks

Tags (4)
0 Kudos
1 Solution
803 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

It can use DMA channel link function, such as DMA CH0 as half low buffer and DMA CH1 as half top buffer.

DMA CH0 <=> DMA CH1.

When DMA CH0 finish the transfer link to DMA CH1 for transfer; and when DMA CH1 finish transfer, link to DMA CH0 start.

There need to use DMA continuous mode.

And in each DMA interrupt, the CPU can load new data to each DMA channel related data array.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
804 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

It can use DMA channel link function, such as DMA CH0 as half low buffer and DMA CH1 as half top buffer.

DMA CH0 <=> DMA CH1.

When DMA CH0 finish the transfer link to DMA CH1 for transfer; and when DMA CH1 finish transfer, link to DMA CH0 start.

There need to use DMA continuous mode.

And in each DMA interrupt, the CPU can load new data to each DMA channel related data array.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
803 Views
wendersonolivei
Contributor IV

Hi Hui,

Thanks for help!

Regards

0 Kudos