I2S time slots and DMA buffers

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

I2S time slots and DMA buffers

Jump to solution
2,187 Views
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 Solution
1,100 Views
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

View solution in original post

0 Kudos
4 Replies
1,101 Views
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 Kudos
1,101 Views
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 Kudos
1,103 Views
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?

1,101 Views
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 Kudos