eUSCI Operation – SPI Mode
800
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
Enhanced Universal Serial Communication Interface (eUSCI) – SPI Mode
31.3 eUSCI Operation – SPI Mode
In SPI mode, serial data is transmitted and received by multiple devices using a shared clock provided by
the master. An additional pin controlled by the master, UCxSTE, is provided to enable a device to receive
and transmit data.
Three or four signals are used for SPI data exchange:
•
UCxSIMO – slave in, master out
Master mode: UCxSIMO is the data output line.
Slave mode: UCxSIMO is the data input line.
•
UCxSOMI – slave out, master in
Master mode: UCxSOMI is the data input line.
Slave mode: UCxSOMI is the data output line.
•
UCxCLK – eUSCI SPI clock
Master mode: UCxCLK is an output.
Slave mode: UCxCLK is an input.
•
UCxSTE – slave transmit enable.
Used in 4-pin mode to allow multiple masters on a single bus. Not used in 3-pin mode.
describes the UCxSTE operation.
Table 31-1. UCxSTE Operation
UCMODEx
UCxSTE
Active State
UCxSTE
Slave
Master
01
High
0
Inactive
Active
1
Active
Inactive
10
Low
0
Active
Inactive
1
Inactive
Active
31.3.1 eUSCI Initialization and Reset
The eUSCI is reset by a PUC or by the UCSWRST bit. After a PUC, the UCSWRST bit is automatically
set, keeping the eUSCI in a reset condition. When set, the UCSWRST bit resets the UCRXIE, UCTXIE,
UCRXIFG, UCOE, and UCFE bits, and sets the UCTXIFG flag. Clearing UCSWRST releases the eUSCI
for operation.
Configuring and reconfiguring the eUSCI module should be done when UCSWRST is set to avoid
unpredictable behavior.
NOTE:
Initializing or reconfiguring the eUSCI module
The recommended eUSCI initialization or reconfiguration process is:
1.
Set UCSWRST.
BIS.B #UCSWRST,&UCxCTL1
2.
Initialize all eUSCI registers with UCSWRST = 1 (including UCxCTL1).
3.
Configure ports.
4.
Ensure that any input signals into the SPI module such as UCxSOMI (in master mode)
or UCxSIMO and UCxCLK (in slave mode) have settled to their final voltage levels
before clearing UCSWRST and avoid any unwanted transitions during operation.
5.
Clear UCSWRST.
BIC.B #UCSWRST,&UCxCTL1
6.
Enable interrupts (optional) with UCRXIE or UCTXIE.