I2S time slots and DMA buffers

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

I2S time slots and DMA buffers

跳至解决方案
4,156 次查看
future_boston
Contributor II

I want to use the DMA controller with the I2S interface (now the SAI on the 120MHz Kinetis K60).  When I go to setup a DMA channel with PE, it allows me to define the number of time slots but only one buffer to transmit or receive from.

 

It would seem that if the DMA channel could split up the time slots, it would require X number of buffers for X number of time slots but I don’t see any capability to set up this buffer structure.  Can PE arrange to DMA time slots to separate buffers?

1 解答
3,069 次查看
jiri_rezler
NXP Employee
NXP Employee

Hello

The SAI device (on the Kinetis 120MHz) does not allow division of “Time slots” data stream.
Data frames (x frames) are stored in a one data stream buffer. Data arrangement in the data buffer is dependent on the sequence transmission "Time slots" 0,1,2,... in frame.
For a I2S codec are used only 2 time slots (0,1) and data arrangement in buffer is

Slot:   0                       1
LeftChannel, RightCHannel,    // Sample 0
LeftChannel, RightCHannel,    // Sample 1
LeftChannel, RightCHannel,    // Sample 2
LeftChannel, RightCHannel,    // Sample 3
...
LeftChannel, RightCHannel,    // Sample n


=> Buffer arrangement:  uint16_t Buffer[2][SampleNum];  // first index: 0 = LeftChannel, 1= RightChanne

在原帖中查看解决方案

0 项奖励
回复
4 回复数
3,070 次查看
egoodii
Senior Contributor III

I know I am ridiculously late to this thread, but I just came across it(!).  I just want anyone reading to know that the offset addresses, minor/major-loop counters, and half-full interrupts in the Kinetis DMA allow that DMA engine to FULLY deinterleave the I2S/SAI timeslot information into individual double-buffered linear sample arrays (arranged as a contiguous block) with no CPU overhead.  See my original port on this.  As pointed out in other discussions, this whole arrangement of timeslots thru the I2S/SAI FIFO interface relies on matching count operations at both the source and destination, but it works very nicely!

0 项奖励
回复
3,070 次查看
bosleymusic_com
Contributor IV

Can you provide a link to your original post on this. I'd like to see it, and couldn't find it among your activity.

0 项奖励
回复
3,072 次查看
egoodii
Senior Contributor III

I don't use PE, and my 'demo' is not for Version 2 silicon, but you should still get some ideas on how to use DMA to create double-buffer linear data areas:

is there any demo code for using I2S?

3,070 次查看
jiri_rezler
NXP Employee
NXP Employee

Hello

The SAI device (on the Kinetis 120MHz) does not allow division of “Time slots” data stream.
Data frames (x frames) are stored in a one data stream buffer. Data arrangement in the data buffer is dependent on the sequence transmission "Time slots" 0,1,2,... in frame.
For a I2S codec are used only 2 time slots (0,1) and data arrangement in buffer is

Slot:   0                       1
LeftChannel, RightCHannel,    // Sample 0
LeftChannel, RightCHannel,    // Sample 1
LeftChannel, RightCHannel,    // Sample 2
LeftChannel, RightCHannel,    // Sample 3
...
LeftChannel, RightCHannel,    // Sample n


=> Buffer arrangement:  uint16_t Buffer[2][SampleNum];  // first index: 0 = LeftChannel, 1= RightChanne

0 项奖励
回复