AT32F421
Series Reference Manual
2022.11.11
Page 167
Rev 2.02
Bit 7
LTF
0x0
rw
LSB transmit first
This bit is used to select for MST transfer first or LSB
transfer first.
0: MSB
1: LSB
Bit 6
SPIEN
0x0
rw
SPI enable
0: Disabled
1: Enabled
Bit 5: 3
MDIV
0x0
rw
Master clock frequency division
In master mode, the peripheral clock divided by the
prescaler is used as SPI clock. The MDIV[3] bit is in the
SPI_CTRL2 register, MDIV[3: 0]:
0000: Divided by 2
0001: Divided by 4
0010: Divided by 8
0011: Divided by 16
0100: Divided by 32
0101: Divided by 64
0110: Divided by 128
0111: Divided by 256
1000: Divided by 512
1001: Divided by 1024
Bit 2
MSTEN
0x0
rw
Master enable
0: Disabled (Slave)
1: Enabled (Master)
Bit 1
CLKPOL
0x0
rw
Clock polarity
Indicates the polarity of clock output in idle state.
0: Low level
1: High level
Bit 0
CLKPHA
0x0
rw
Clock phase
0: Data capture starts from the first clock edge
1: Data capture starts from the second clock edge
Note: The SPI_CTRL1 register must be 0 in I
2
S mode.
13.4.2 SPI control register2 (SPI_CTRL2)
Bit
Register
Reset value
Type
Description
Bit 15: 9
Reserved
0x00
resd
Forced to be 0 by hardware.
Bit 8
MDIV
0x0
rw
Master clock frequency division
Refer to the MDIV[2: 0] of the SPI_CTRL1 register.
Bit 7
TDBEIE
0x0
rw
Transmit data buffer empty interrupt enable
0: Disabled
1: Enabled
Bit 6
RDBFIE
0x0
rw
Receive data buffer full interrupt enable
0: Disabled
1: Enabled
Bit 5
ERRIE
0x0
rw
Error interrupt enable
This bit controls interrupt generation when errors occur
(CCERR, MMERR, ROERR and TUERR)
0: Disabled
1: Enabled
Bit 4: 3
Reserved
0x0
resd
Kept at its default value
Bit 2
HWCSOE
0x0
rw
Hardware CS output enable
This bit is valid only in master mode. When this bit is set,
the I/O output on the CS pin is low; when this bit is 0, the
I/O input on the CS pin must be set high.
0: Disabled
1: Enabled
Bit 1
DMATEN
0x0
rw
DMA transmit enable
0: Disabled
1: Enabled
Bit 0
DMAREN
0x0
rw
DMA receive enable
0: Disabled
1: Enabled