AT32F425
Series Reference Manual
2022.03.30
Page 167
Ver 2.01
13.2.6 DMA transfer
The SPI supports write and read operations with DMA. Refer to the following configuration procedure.
Special attention should be paid to: when the CRC calculation and check is enabled, the number of
data transferred by DMA is configured as the number of the data to be transferred. The number of data
read with DMA is configured as the number of the data to be received. In this case, the hardware will
send CRC automatically at the end of full transfer, and the receiver will also perform CRC check. Note
that the received CRC data will be moved into the SPI_DT register by hardware, with the RDBF being
set, and the DMA read request will be sent if then DAM transfer is enabled. Hence, it is recommended
to read the SPI_DT register to get the CRC value at the end of CRC reception in order to avoid the
upcoming transfer error.
Transmission with DMA
Select DMA channel: Select a DMA channel for the current SPI from DMA channel map table
described in DMA chapter.
Configure the destination of DMA transfer: Configure the SPI_DT register address as the
destination address bit of DMA transfer in the DMA control register. Datat will be sent to this address
after transmit request is received by DMA.
Configure the source of DMA transfer: Configure the memory address as the source of DMA
transfer in the DMA control register. Data will be loaded into the SPI_DT register from the memory
address after transmit request is received by DMA.
Configure the total number of bytes to be transferred in the DMA control register.
Configure the channel priority of DMA transfer in the DMA control register.
Configure DMA interrupt generation after half or full transfer in the DMA control register.
Enable DMA transfer channel in the DMA control register.
Reception with DMA
Select DMA transfer channel: Select a DMA channel for the current SPI from DMA channel map
table described in DMA chapter.
Configure the destination of DMA transfer: Configure the memory address as the destination of
DMA transfer in the DMA control register. Data will be loaded from the SPI_DT register to the
programmed destination after reception request is received by DMA.
Configure the source of DMA transfer: Configure the SPI_DT register address as the source of
DMA transfer in the DMA control register. Data will be loaded from the SPI_DT register to the
programmed destination after reception request is received by DMA.
Configure the total number of bytes to be transferred in the DMA control register.
Configure the total number of bytes to be transferred in the DMA control register.
Configure DMA interrupt generation after half or full transfer in the DMA control registe
Enable DMA transfer channel in the DMA control register.
13.2.7 TI mode
The SPI interface is compatible with the TI protocol. The TI mode is enabled by setting the TIEN bit.
In this mode, the SPI interface will generates a communication clock SPI_CLK in accordance with the
TI protocol. This means that the SPI_CLK polarity and phase are forced to conform to the TI protocol
requirements, without the need of the intervention of CLKPOL and CLKPHA bits. Thus the CLKPOL and
CLKPHA bits cannot be used to change the polarity and phase of the SPI_CLK either.
In this mode, the SPI interface will generate a CS signal in accordance with the TI protocol, meaning
that the CS input and ouput are forced to conform to the TI protocol requirements, without the need of
the intervention of SWCSEN, SWCSIL and HWCSOE bits. Thus, the SWCSEN, SWCSIL and HWCSOE
bits cannot be used for CS signal management either.
In slave mode, once the TI mode is enabled, the SPI slave controls the MISO pin only during data
transmission, meaning that the MISO pin state remains Hi-Z in idle state.
In slave mode, once the TI mode is enabled, the SPI interface is capable of detecting CS pulse errors
during data transmission, and setting the CSPAS bit (It is cleared by reading the SPI_STS) as soon as