Hardware

SPI Interface

LEEHANDS 2021. 6. 17. 15:23
반응형

1.3 SPI Background

1.3.1 SPI History

SPI is a serial communication bus developed by Motorola. It is a full-duplex protocol which functions on a master-slave paradigm that is ideally suited to data streaming applications.

1.3.2 SPI Theory of Operation

SPI requires four signals: clock (SCLK), master output/slave input (MOSI), master input/slave output (MISO), and slave select (SS).

Figure 25 : Sample SPI Implementation.
Each slave device requires a separate slave select signal (SS). This means that as devices are added, the circuit increases in complexity.

 

Three signals are shared by all devices on the SPI bus: SCLK, MOSI, and MISO. SCLK is generated by the master device and is used for synchronization. MOSI and MISO are the data lines. The direction of transfer is indicated by their names. Data is always transferred in both directions in SPI, but an SPI device interested in only transmitting data can choose to ignore the receive bytes. Likewise, a device only interested in the incoming bytes can transmit dummy bytes.

Each device has its own SS line. The master pulls low on a slave's SS line to select a device for communication.

The exchange itself has no pre-defined protocol. This makes it ideal for data-streaming applications. Data can be transferred at high speed, often into the range of the tens of megahertz. The flipside is that there is no acknowledgment, no flow control, and the master may not even be aware of the slave's presence.

1.3.3 SPI Modes

Although there is no protocol, the master and slave need to agree about the data frame for the exchange. The data frame is described by two parameters: clock polarity (CPOL) and clock phase (CPHA). Both parameters have two states which results in four possible combinations. These combinations are shown in Figure 26.

Figure 26 : SPI Modes
The frame of the data exchange is described by two parameters, the clock polarity (CPOL) and the clock phase (CPHA). This diagram shows the four possible states for these parameters and the corresponding mode in SPI.

1.3.4 SPI Benefits and Drawbacks

SPI is a very simple communication protocol. It does not have a specific high-level protocol which means that there is almost no overhead. Data can be shifted at very high rates in full duplex. This makes it very simple and efficient in a single-master single-slave scenario.

Because each slave needs its own SS, the number of traces required is n+3, where n is the number of SPI devices. This means increased board complexity when the number of slaves is increased.

반응형

'Hardware' 카테고리의 다른 글

Little endian / Big endian  (0) 2021.08.09
Xbee, 초기 설정  (0) 2021.07.15
I2C interface  (0) 2021.06.17
Charge Pump ( 차지펌프 ) ?  (0) 2021.01.26
기초전자공학, Bias (바이어스) 는 무엇일까?  (0) 2021.01.19