DMA as double buffer

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

DMA as double buffer

跳至解决方案
1,336 次查看
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

标记 (4)
0 项奖励
1 解答
833 次查看
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 项奖励
2 回复数
834 次查看
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 项奖励
833 次查看
wendersonolivei
Contributor IV

Hi Hui,

Thanks for help!

Regards

0 项奖励