
1-139
Under
development
Specifications in this manual are tentative and subject to change
Rev. H
UART2 in SPI mode
MITSUBISHI MICROCOMPUTERS
M30222 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
When operated in SPI mode the UART2 package pins provide the alternate SPI functions. MOSI,
Master Out Slave In, is multiplexed on pin P7[0]/TxD2. MOSI outputs data when UART2 is a SPI
master and inputs data when UART2 is a SPI slave. MISO, Master In Slave Out, is multiplexed on pin
P7[1]/RxD2. MISO inputs data when UART2 is a SPI master and outputs data when UART2 is a SPI
slave. SPICLK, SPI Clock, is multiplexed on pin P7[2]/CLK2. The SPI clock is input when the SPI is
configured as a slave or output when the SPI is configured as a master. SSB, Slave select input, is
multiplexed on pin P7[3]/RTSB/CTSB. This pin is used to select the active SPI slave.
The M30222 UART2 can be operated as an SPI master or as an SPI slave. Operation as an SPI Slave
or SPI Master is determined by the CKDIR contol bit. While in SPI mode, the TxD and RxD pins act as
the SPI MOSI and MISO pins. As implemented on the M30222, the SPI pins MOSI and MISO are
open drain.
There are two added control bits and one added status flag. Control bit SPIM is the SPI Mode enable,
which enables SPI operation. CPHA is the Clock Phase selection control bit. CPHA is used to
chooses the clock to data relationship. Combined with the existing CKPOL control bit, CPHA provides
compatibility with all four SPI transmission modes. CPHA is held at “0” when SPIM = “0”. The status
flag MDFLT is used to indicate that an SPI mode fault occurred.
Several existing configuration bits are required for SPI operation. SPI Slave / Master mode is con-
trolled by the existing CKDIR control bit. The UART is in SPI master mode when the clock is gener-
ated internally and is in SPI slave mode when the clock is generated externally. CKPOL control bit
select the polarity of the transfer clock. The four different combinations of CKPOL and CPHA define
the four formats of the SPI communication protocols. While in SPI mode, the CRD control bit enables
the CTS/RTS pin to operate as SSB and CRS control bit selects CTS/RTS pin to operate as CTS/
SSB. Both control bits must be properly configured to activate the SSB function. UFORM control bit
selects the UART transfer format, MSB or LSB. SPI data is transmitted MSB first.
Fig. 1.110. SPI system level view
Master MCU
Slave MCU
MISO
MOSI
SPICLK
SSB
MISO
MOSI
SPICLK
SSB
CSB
Slave MCU s SSB input may be tied to ground
if there is only one SPI slave in the system.