
M0A21/M0A23 Series
May 06, 2022
Page
543
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
register as long as TXFULL (USPI_BUFSTS[9]) is 0.
For Slave mode:
1. Enable USCI peripheral clock by setting CLK_APBCLK1 register.
2. Configure user-specified pins as USCI function pins by setting corresponding multiple
function control registers.
3. Set FUNMODE (USPI_CTL[2:0]) to 1 to select SPI mode.
4.
According to the requirements of user’s application, configure the settings as follows.
ININV (USPI_CTLIN0[2]): If the slave selection signal is active low, set this bit to 1;
otherwise, set it to 0.
DWIDTH (USPI_LINECTL[11:8]): Data width setting.
LSB (USPI_LINECTL[0]): LSB first or MSB first.
TSMSEL (USPI_PROTCTL[14:12]): Full-duplex SPI transfer or one channel half-duplex
SPI transfer.
SCLKMODE (USPI_PROTCTL[7:6]): Determine the clock timing.
SLAVE (USPI_PROTCTL[0]): Set to 1 for Slave mode.
5. Set PROTEN (USPI_PROTCTL[31]) to 1 to enable SPI protocol.
6. Write USPI_TXDAT register for transmission. In half-duplex SPI transfer, the data pin
direction is determined by PORTDIR (USPI_TXDAT[16]) setting.
7. User can get the received data by reading USPI_RXDAT register as long as RXEMPTY
(USPI_BUFSTS[0]) is 0. The next datum for transmission can be written to USPI_TXDAT
register as long as TXFULL (USPI_BUFSTS[9]) is 0.
Wake-up Function
The USCI Controller in SPI mode supports wake-up system function. The wake-up source in SPI
protocol is the transition of input slave select signal.
6.14.6 Register Map
R:
read only,
W:
write only,
R/W:
both read and write
Register
Offset
R/W Description
Reset Value
USCI_SPI Base Address:
USPIn_BA = 0x400 (0x1000 * n)
n= 0, 1
USPI_CTL
U0x00
R/W USCI Control Register
0x0000_0000
USPI_INTEN
U0x04
R/W USCI Interrupt Enable Register
0x0000_0000
USPI_BRGEN
U0x08
R/W USCI Baud Rate Generator Register
0x0000_3C00
USPI_DATIN0
U0x10
R/W USCI Input Data Signal Configuration Register 0
0x0000_0000
USPI_CTLIN0
U0x20
R/W USCI Input Control Signal Configuration Register 0
0x0000_0000
USPI_CLKIN
U0x28
R/W USCI Input Clock Signal Configuration Register
0x0000_0000
USPI_LINECTL
U0x2C
R/W USCI Line Control Register
0x0000_0000
USPI_TXDAT
U0x30
W
USCI Transmit Data Register
0x0000_0000