The I2 S module implements EasyDMA for accessing internal Data RAM without CPU
intervention.
The source and destination pointers for the TX and RX data are configured in TXD.PTR and RXD.PTR . The memory pointed to by these pointers
will only be read or written when TX or RX are enabled in CONFIG.TXEN , and
CONFIG.RXEN .
The addresses written to the pointer registers TXD.PTR and RXD.PTR are double-buffered in hardware. These double buffers are updated for every
number of transmitted bytes given by RXTXD.MAXCNT read from/written to
memory. The events TXPTRUPD and RXPTRUPD are generated whenever the TXD.PTR and RXD.PTR are
transferred to these double buffers.
If TXD.PTR is not pointing to the Data RAM region when transmission is
enabled, or RXD.PTR is not pointing to the Data RAM region when reception
is enabled, an EasyDMA transfer may result in a HardFault and/or memory corruption. See Memory for more information about the different memory regions.
Due to the nature of I2 S, where the number of transmitted samples always equals the
number of received samples (at least when both TX and RX are enabled), one common register
RXTXD.MAXCNT is used for specifying the sizes of these two memory
buffers. The size of the buffers is specified in bytes.
In Stereo mode (CONFIG.CHANNELS =Stereo), the samples
are stored as left and right sample pairs in memory. Memory mapping for 8-bit stereo. CONFIG.SWIDTH = 8Bit, CONFIG.CHANNELS = Stereo. , Memory mapping for 16-bit stereo. CONFIG.SWIDTH = 16Bit, CONFIG.CHANNELS = Stereo. and
Memory mapping for 24-bit stereo. CONFIG.SWIDTH = 24Bit, CONFIG.CHANNELS = Stereo.
show how the samples are mapped to
memory in this mode. The mapping is valid for both RX and TX.
In Mono mode (CONFIG.CHANNELS =Left or Right), RX sample from only one channel in the frame is stored in
memory, the other channel sample is ignored.
Memory mapping for 8-bit mono. CONFIG.SWIDTH = 8Bit, CONFIG.CHANNELS = Left. ,
Memory mapping for 16-bit mono, left channel only. CONFIG.SWIDTH = 16Bit, CONFIG.CHANNELS
= Left. and
Memory mapping for 24-bit mono, left channel only. CONFIG.SWIDTH = 24Bit, CONFIG.CHANNELS
= Left.
show how RX samples are mapped to memory in this mode.
For TX, the same outgoing sample read from memory is transmitted on both left and right in a frame,
resulting in a mono output stream.
Figure 13. Memory mapping for 8-bit stereo. CONFIG.SWIDTH = 8Bit, CONFIG.CHANNELS = Stereo.
Page-1
Rectangle.116
Sheet.118
0
0
Sheet.119
31
31
Sheet.120
16
16
Sheet.124
15
15
Sheet.136
24
24
Sheet.137
23
23
Sheet.138
8
8
Sheet.139
7
7
Sheet.140
Sheet.123
x.PTR + (n*2) - 4
x.PTR + (n*2) - 4
Rectangle.23
Right sample n-1
Right sample n -1
Rectangle.24
Left sample n-1
Left sample n -1
Rectangle.25
Right sample n-2
Right sample n -2
Rectangle.26
Left sample n-2
Left sample n -2
Sheet.141
Sheet.122
x.PTR + 4
x.PTR + 4
Rectangle.19
Right sample 3
Right sample 3
Rectangle.20
Left sample 3
Left sample 3
Rectangle.21
Right sample 2
Right sample 2
Rectangle.22
Left sample 2
Left sample 2
Sheet.142
Rectangle.117
Right sample 1
Right sample 1
Sheet.121
x.PTR
x.PTR
Rectangle.16
Left sample 1
Left sample 1
Rectangle.17
Right sample 0
Right sample 0
Rectangle.18
Left sample 0
Left sample 0
Figure 14. Memory mapping for 8-bit mono. CONFIG.SWIDTH = 8Bit, CONFIG.CHANNELS = Left.
Page-1
Rectangle
Sheet.94
0
0
Sheet.95
31
31
Sheet.96
16
16
Sheet.100
15
15
Sheet.101
24
24
Sheet.102
23
23
Sheet.103
8
8
Sheet.104
7
7
Sheet.116
Sheet.99
x.PTR + n - 4
x.PTR + n - 4
Rectangle.39
Left sample n-1
Left sample n-1
Rectangle.40
Left sample n-2
Left sample n-2
Rectangle.41
Left sample n-3
Left sample n-3
Rectangle.42
Left sample n-4
Left sample n-4
Sheet.117
Sheet.98
x.PTR + 4
x.PTR + 4
Rectangle.35
Left sample 7
Left sample 7
Rectangle.36
Left sample 6
Left sample 6
Rectangle.37
Left sample 5
Left sample 5
Rectangle.38
Left sample 4
Left sample 4
Sheet.118
Rectangle.2
Left sample 3
Left sample 3
Sheet.97
x.PTR
x.PTR
Rectangle.32
Left sample 2
Left sample 2
Rectangle.33
Left sample 1
Left sample 1
Rectangle.34
Left sample 0
Left sample 0
Figure 15. Memory mapping for 16-bit stereo. CONFIG.SWIDTH = 16Bit, CONFIG.CHANNELS = Stereo.
Page-1
Rectangle.154
Rectangle.155
Right sample 0
Right sample 0
Rectangle.156
Left sample 0
Left sample 0
Sheet.157
0
0
Sheet.158
31
31
Rectangle.159
Right sample 1
Right sample 1
Rectangle.160
Left sample 1
Left sample 1
Rectangle.161
Right sample n - 1
Right sample n - 1
Rectangle.162
Left sample n - 1
Left sample n - 1
Sheet.163
16
16
Sheet.164
x.PTR
x.PTR
Sheet.165
x.PTR + 4
x.PTR + 4
Sheet.166
x.PTR + (n*4) - 4
x.PTR + (n*4) - 4
Sheet.167
15
15
Figure 16. Memory mapping for 16-bit mono, left channel only. CONFIG.SWIDTH = 16Bit, CONFIG.CHANNELS
= Left.
Page-1
Rectangle
Sheet.143
0
0
Sheet.144
31
31
Sheet.149
16
16
Sheet.153
15
15
Sheet.154
Rectangle.6
Left sample 3
Left sample 3
Rectangle.7
Left sample 2
Left sample 2
Sheet.151
x.PTR + 4
x.PTR + 4
Sheet.155
Rectangle.2
Left sample 1
Left sample 1
Rectangle.3
Left sample 0
Left sample 0
Sheet.150
x.PTR
x.PTR
Sheet.156
Rectangle.8
Left sample n - 1
Left sample n - 1
Rectangle.9
Left sample n - 2
Left sample n - 2
Sheet.152
x.PTR + (n*2) - 4
x.PTR + (n*2) - 4
Figure 17. Memory mapping for 24-bit stereo. CONFIG.SWIDTH = 24Bit, CONFIG.CHANNELS = Stereo.
Page-1
Rectangle.191
Rectangle.192
Left sample 0
Left sample 0
Sheet.193
0
0
Sheet.194
31
31
Sheet.195
x.PTR
x.PTR
Sheet.196
x.PTR + 4
x.PTR + 4
Sheet.197
x.PTR + (n*8) - 8
x.PTR + (n*8) - 8
Rectangle.16
Right sample 0
Right sample 0
Sheet.201
23
23
Rectangle.25
Left sample n - 1
Left sample n - 1
Rectangle.28
Right sample n - 1
Right sample n - 1
Sheet.209
Sheet.210
x.PTR + (n*8) - 4
x.PTR + (n*8) - 4
Rectangle.211
Sign ext.
Sign ext.
Rectangle.213
Sign ext.
Sign ext.
Rectangle.214
Sign ext.
Sign ext.
Rectangle.215
Sign ext.
Sign ext.
Figure 18. Memory mapping for 24-bit mono, left channel only. CONFIG.SWIDTH = 24Bit, CONFIG.CHANNELS
= Left.
Page-1
Rectangle
Rectangle.3
Left sample 0
Left sample 0
Sheet.170
0
0
Sheet.171
31
31
Sheet.172
x.PTR
x.PTR
Sheet.173
x.PTR + 4
x.PTR + 4
Sheet.174
x.PTR + (n*4) - 4
x.PTR + (n*4) - 4
Sheet.178
23
23
Rectangle.184
Sign ext.
Sign ext.
Rectangle.186
Left sample 1
Left sample 1
Rectangle.187
Sign ext.
Sign ext.
Rectangle.188
Left sample n - 1
Left sample n - 1
Rectangle.189
Sign ext.
Sign ext.
Figure 19. Memory mapping for 32-bit stereo. CONFIG.SWIDTH = 32Bit, CONFIG.CHANNELS = Stereo.
Page-1
Rectangle.225
Rectangle.226
Left sample 0
Left sample 0
Sheet.227
0
0
Sheet.228
31
31
Sheet.229
x.PTR
x.PTR
Sheet.230
x.PTR + 4
x.PTR + 4
Sheet.231
x.PTR + (n*8) - 8
x.PTR + (n*8) - 8
Rectangle.16
Right sample 0
Right sample 0
Rectangle.25
Left sample n - 1
Left sample n - 1
Rectangle.28
Right sample n - 1
Right sample n - 1
Sheet.235
x.PTR + (n*8) - 4
x.PTR + (n*8) - 4
Figure 20. Memory mapping for 32-bit mono, left channel only. CONFIG.SWIDTH = 32Bit, CONFIG.CHANNELS
= Left.
Page-1
Rectangle
Rectangle.3
Left sample 0
Left sample 0
Sheet.218
0
0
Sheet.219
31
31
Sheet.220
x.PTR
x.PTR
Sheet.221
x.PTR + 4
x.PTR + 4
Sheet.222
x.PTR + (n*4) - 4
x.PTR + (n*4) - 4
Rectangle.223
Left sample 1
Left sample 1
Rectangle.224
Left sample n - 1
Left sample n - 1