I2S time slots and DMA buffers

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I2S time slots and DMA buffers

ソリューションへジャンプ
3,728件の閲覧回数
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 解決策
2,641件の閲覧回数
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 返答(返信)
2,642件の閲覧回数
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 件の賞賛
返信
2,642件の閲覧回数
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 件の賞賛
返信
2,644件の閲覧回数
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?

2,642件の閲覧回数
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 件の賞賛
返信