AT32F421
Series Reference Manual
2022.11.11
Page 164
Rev 2.02
Configure DMA interrupt generation after half or full transfer in the DMA control register
Enable DMA transfer channel in the DMA control register.
13.3.6 Transmitter/Receiver
Whether being used as SPI or I
2
S, there is no difference for CPU. The SPI (in whatever mode) shares
the same base address, the same SPI_DT register, the same transmitter and receiver. The SPI
transmitter and receiver is responsible for sending and receiving the desired data frame according to the
configuration of the communication controller. Thus their status flags such as TDBE, RDBF and ROERR,
and their interrupt enable bits including TDBEIE, RDBFIE and ERRIE are identical.
Special attention must be paid to:
CRC check is not available on the I
2
S. Any operation linked to CRC, including CCERR flag and
the corresponding interrupts, is not supported.
I
2
S protocol needs decode the current channel status. The ACS bit is used to judge whether the
current transfer occurs on the left channel (ACS=0) or the right channel (ACS=1).
TUERR bit indicates whether an underrun occurs. TUERR=1 means an underrun error occurs on
the transmitter. An interrupt is generated when the ERRIE is set.
Read/write operation to the SPI_DT register is different under different audio protocols, data bits
and channel bits. Refer to the audio protocol selector section for more information.
Pay more attention to the I
2
S disable operation under different configurations, shown as follows:
—
I2SDBN=00, I2SCBN=1, STDSLE=10: wait for the second-to-last RDBF=1 and 17 CK periods
before disabling the I
2
S
— I2SDBN=00, I2SCBN=1, STDSLE=00 or STDSLE=01 or STDSLE=11: wait for the last RDBF=1
and one CK period before the I
2
S
— I2SDBN, I2SCBN,STDSLE combination: wait for the second-to-last RDBF=1 and one CK
period before disabling the I
2
S.
I
2
S transmitter configuration procedure:
Configure operation mode selector
Configure audio protocol selector
Configure I2S_SCK controller
Configure DMA transfer (if necessary)
Set the I2SEN bit to enable I
2
S
I
2
S receiver configuration procedure:
Configure operation mode selector
Configure audio protocol selector
Configure I2S_SCK controller
Configure DMA transfer (if necessary)
Set the I2SEN bit to enable I
2
S