![Texas Instruments AM1808 Скачать руководство пользователя страница 1420](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581420.webp)
SPIx_CLK
SPIx_SOMI
SPIx_SIMO
Slave
(MASTER = 0; CLKMOD = 0)
SPIx_CLK
SPIx_SOMI
SPIx_SIMO
Master
(MASTER = 1; CLKMOD = 1)
Write to SPIDAT1
SPIx_CLK
SPIx_SIMO
SPIx_SOMI
SPIBUF
SPIDAT1
CPU/DMA
write
CPU/DMA
read
SPIDAT1
SPIBUF
CPU/DMA
read
CPU/DMA
write
Architecture
1420
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Serial Peripheral Interface (SPI)
29.2.7 SPI Operation: 3-Pin Mode
NOTE:
If only unidirectional communication is required, the SPIx_CLK pin and the two data pins
(SPIx_SOMI and SPIx_SIMO) must all be configured as functional pins. A 2-pin
unidirectional mode is not supported.
The SPI 3-pin mode uses only the clock (SPIx_CLK) and data (SPIx_SOMI and SPIx_SIMO) pins for
bidirectional communication between master and slave devices.
shows the basic 3-pin SPI
option.
To select the 3-pin SPI option, the SPIx_CLK, SPIx_SOMI, and SPIx_SIMO pins should be configured as
functional pins by configuring the SPI pin control register 0 (SPIPC0). The SPIx_SCS[n] and SPIx_ENA
pins can be used as general-purpose I/O pins by configuring the SPIPC1 through SPIPC5 registers.
The SPI operates in either master or slave mode. The CLKMOD and MASTER bits in the SPI global
control register 1 (SPIGCR1) select between master and slave mode; both must be programmed to 1 to
configure the SPI for master mode or to 0 to configure the SPI for slave mode. The SPI bus master is the
device that drives the SPIx_CLK signal and initiates SPI bus transfers. In SPI master mode, the
SPIx_SOMI pin output buffer is in a high-impedance state and the SPIx_CLK and the SPIx_SIMO pin
output buffer is enabled. In SPI slave mode, the SPIx_SIMO and SPIx_CLK pin output buffer is in a high-
impedance state and the SPIx_SOMI pin output buffer is enabled.
In master mode with the 3-pin option, the CPU writes transmit data to the SPI transmit data registers
(SPIDAT0[15:0] or SPIDAT1[15:0]). This initiates a transfer. A series of clocks pulses will be driven out on
the SPIx_CLK pin to complete the transfer. Each clock pulse on the SPIx_CLK pin causes the
simultaneous transfer (in both directions) of one bit by both the master and slave SPI devices. CPU writes
to the configuration bits in SPIDAT1 (not writing to SPIDAT1[15:0]) do not result in a new transfer. When
the selected number of bits has been transmitted, the received data is transferred to the SPI receive buffer
register (SPIBUF) for the CPU to read. Data is stored right-justified in SPIBUF.
In slave mode with 3-pin option, CPU writes to SPIDAT0[15:0] or SPIDAT1[15:0] makes the slave ready to
transmit. CPU writes to the configuration bits in SPIDAT1 (not writing to SPIDAT1[15:0]) do not make the
slave ready to transmit.
NOTE:
Either SPIDAT0 or SPIDAT1 can be used on both master and slaves sides.
Figure 29-2. SPI 3-Pin Option