AT32F421
Series Reference Manual
2022.11.11
Page 161
Rev 2.02
Select channel bits by setting the I2SCBN bit
I2SDBN =0: 16 bit
I2SDBN =1: 32 bit
Note: Read/Write operation mode depends on the selected audio protocols, data bits and channel bits.
The following lists all possible configuration combinations and their respective read and write operation
mode.
Philips standard, PCM standard, MSB-aligned or LSB-aligned standard, 16-bit data and 16-bit
channel
The data bit is the same as the channel bit. Each channel requires one read/write operation
from/ to the SPI_DT register, and the number of DMA transfer is 1.
Philips standard, PCM standard or MSB-aligned standard, 16-bit data and 32-bit channel
The data bit is different from the channel bit. Each channel requires one read/write operation
from/to the SPI_DT register, and the number of DMA transfer is 1. The first 16 bits (MSB) are the
significant bits, and the 16-bit LSB is forced to 0 by hardware.
Philips standard, PCM standard or MSB-aligned standard, 24-bit data and 32-bit channel
The data bit is different from the channel bit. Each channel requires two read/write operations
from/to the SPI_DT register, and the number of DMA transfer is 2. The 16-bit MSB transmits and
receives the first 16-bit data, the 16-bit LSB transmits and receives the 8-bit MSB data, with 8-bit
LSB data being forced to 0 by hardware.
Philips standard, PCM standard, MSB-aligned or LSB-aligned standard, 32-bit data and 32-bit
channel
The data bit is the same as the channel bit. Each channel requires two read/write operations
from/to the SPI_DT register, and the number of DMA transfer is 2. These 32-bit data are
proceeded in two times, with 16-bit data each time.
LSB-aligned standard, 16-bit data and 32-bit channel
The data bit is different from the channel bit. Each channel requires one read/write operation
from/to the SPI_DT register, and the number of DMA transfer is 1. The 16 bits (LSB) are the
significant bits while the first 16-bit data (MSB) are forced to 0 by hardware.
LSB-aligned standard, 24-bit data and 32-bit channel
The data bit is different from the channel bit. Each channel requires two read/write operations
from/to the SPI_DT register, and the number of DMA transfer is 2. For the first 16-bit data, its 8-
bit LSB are the significant bits, with the 8-bit MSB forced to 0 by hardware; the subsequent 16
bits transmit and receive the second 16-bit data.
13.3.4 I2S_CLK controller
The audio protocols the SPI supports adopts synchronous transmission. In master mode, it is required
to generate a communication clock for data reception and transmission on the SPI, and the
communication clock should be output to the slave via IO for data reception and transmission. In slave
mode, the communication clock is provided by master, and is input to the SPI via IO. In all, the I2S_SCK
controller is used for the generation and distribution of I2S_SCK, with the configuration procedure
detailed as follows:
When used as I
2
S master, the SPI can provide communication clock (CK) and main peripheral clock
(MCK) shown in Figure 13-13. The CK and MCK are generated by HCLK divider, with the prescaler of
the MCK determined by I2SDIV and I2SODD. The calculation formula is seen in Figure 13-12.
The prescaler of the CK depends on whether to provide the main clock for peripherals. To ensure that
the main clock is always 256 times larger than the audio sampling frequency, The channel bits should
be taken into account. When the main clock is needed, the CK should be divided by 8 (I2SCBN=0) or 4
(I2SCBN=1), then divided again by the same prescaler as that of the MCK, that is the final
communication clock; When the main clock is not needed, the prescaler of the CK is determined by
I2SDIV and I2SODD, shown in Figure 13-12.