www
.mcu.com.cn
171
/
239
Rev.
1.00
CMS80F731x Reference Manual
20.5 SPI Master Mode
When SPI is configured for host mode, the transfer is initiated by writing to the SPDR registers. When new bytes are written
to the SPDR register, the SPI starts transferring. The serial clock SCLK is generated by the SPI, enabled by the SPI in host
mode, and output.
SPI in master mode can select the SPI slave device via the NSS cable. NSS Line - The slave selection output line loads
the contents of the SSCR registers. The SSCEN bit of the SPSR register is selected between automatic NSS line control and
software control. Place SSCEN in host mode, when SSCEN is set to 1, the NSS line outputs the contents of the SSCR register
while the transmission is in progress, and the NSS is high when the transmission is idle. When the SSCEN bit is cleared, the
NSS cable is controlled by the software and always displays the contents of the SSCR registers, regardless of whether the
transmission is in progress or the SPI is idle.
When SSCEN=1, configure the clock polarity CPOL=0 and the clock phase CPHA=0 for SPI, as shown in the following
figure:
MOSI
SCLK
SPIIF
NSS
D6
D5
D4
D3
D2
D1
D0
D7
D6
D5
D4
D3
D2
D1
D0
D7
When SSCEN=0, configure the clock polarity CPOL=0 and the clock phase CPHA=0 for SPI, as shown in the following
figure:
MOSI
SCLK
SPIIF
NSS
D6
D5
D4
D3
D2
D1
D0
D7
D6
D5
D4
D3
D2
D1
D0
D7