
19 SPI
19-4
EPSON
S1C17003 TECHNICAL MANUAL
19.4 Data Transfer Condition Settings
The SPI module can be set to Master or Slave modes. The SPI clock polarity and phase can also be set via the
SPI_CTL register.
The data length is fixed at 8 bits.
Note: Make sure the SPI module is halted (when SPEN/SPI_CTL register = 0) before Master/Slave
mode selection and clock condition settings.
 SPEN: SPI Enable Bit in the SPI Control (SPI_CTL) Register (D0/0x4326)
Master/Slave mode selection
MSSL (D1/SPI_CTL register) is used to set the SPI module to Master mode or Slave mode. Setting MSSL to 1
sets Master mode; setting it to 0 (default) sets Slave mode. In Master mode, data is transferred using the internal
clock. In Slave mode, data is transferred by inputting the master device clock.
 MSSL: Master/Slave Mode Select Bit in the SPI Control (SPI_CTL) Register (D1/0x4326)
SPI clock polarity and phase settings
The SPI clock polarity is selected by CPOL (D2/SPI_CTL register). Setting CPOL to 1 treats the SPI clock as
active Low; setting it to 0 (default) treats it as active High.
 CPOL: Clock Polarity Select Bit in the SPI Control (SPI_CTL) Register (D2/0x4326)
The SPI clock phase is selected by CPHA (D3/SPI_CTL register).
 CPHA: Clock Phase Select Bit in the SPI Control (SPI_CTL) Register (D3/0x4326)
As shown below, these control bits set transfer timing.
SPICLK(CPOL = 1, CPHA = 1)
SPICLK(CPOL = 1, CPHA = 0)
SPICLK(CPOL = 0, CPHA = 1)
SPICLK(CPOL = 0, CPHA = 0)
SDI/SDO
Receive data load timing
to shift register
D7 (MSB)
D0 (LSB)
Figure 19.4.1: Clock and data transfer timing
MSB initial/LSB initial settings
Use MLSB (D8/SPI_CTL register) to select whether the data MSB or LSB is input or output first.
MSB initial is set when MLSB is 0 (the default value); LSB initial is set when MLSB is 1.
 MLSB: LSB/MSB First Mode Select Bit in the SPI Control (SPI_CTL) Register (D8/0x4326)