www
.mcu.com.cn
170
/
239
Rev.
1.00
CMS80F731x Reference Manual
20.4.3
SPI Device Select Control Register SSCR
The slave device selection control register SSCR can be read or written at any time and is used to configure which slave
selection output should be driven when confirming an SPI host transfer. When the SPI host transfer starts, the contents of the
SSCR register are automatically assigned to the NSS pin.
0xEF
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
SSCR
--
--
--
--
NSSO3
NSSO2
NSSO1
NSSO0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Reset value
1
1
1
1
1
1
1
1
Bit7~Bit4
--
Reserved, must be 1.
Bit3~Bit0
NSSOx:
The SPI selects the control bits from the device (the main chip select output NSS is
NSSOx, x=0-3).
0=
When the SPI host transfer starts, the NSSOx outputs 0.
1=
When the SPI host transfer starts, NSSOx outputs 1.
20.4.4
SPI Status Register SPSR
0xED
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
SPSR
SPISIF
WCOL
--
--
--
--
--
SSCEN
R/W
R
R
--
R
--
--
R/W
R/W
Reset value
0
0
0
0
0
0
0
0
Bit7
SPISIF:
SPI transmission completion interrupt flag bit, read-only;
1=
SPI transmission is completed (read SPSR first, then read/write SPDR and then clear
zero);
0=
The SPI was not transmitted.
Bit6
WCOL:
SPI write violation interrupt flag bit, read-only;
1=
When the SPI transfer is not completed, a collision of the write SPDR operation occurs
(read the SPSR first, then clear the SPDR after reading/writing the SPDR);
0=
No write conflicts.
Bit5~Bit1
--
Reserved, must be 0.
Bit0
SSCEN:
SPI master mode NSS output control bit.
1=
When the SPI is idle, the NSS output is high;
0=
NSS output registers the contents of the SSCR.
The SPI Status Register (SPSR) contains flags that indicate that the transfer was complete or that a system error occurred.
When the corresponding event occurs and is cleared sequentially by the software, all flags are set automatically. By reading
spsr and then accessing spdr, SPISIF and WCOL will be automatically cleared.
The SSCEN bit is the enable bit of the automatic slave selection output. 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 line always displays the contents of the SSCR registers.