SPI interface concept, data transfer, clock polarity, clock phase, and pros and cons

SPI (Serial Peripheral Interface) is a synchronous serial data transmission standard proposed by Motorola. It is widely used in many devices. 1. Interface The SPI interface is often referred to as a 4-wire serial bus and operates in master/slave mode. The data transfer process is initiated by the host. As shown in Figure 1, the four signal lines used are: 1) SCLK: serial clock for synchronous data transmission, output by the host; 2) MOSI: master output slave input data line; 3) MISO: The host inputs the slave output data line; 4) SS: Chip select line, active low, output by the host. On the SPI bus, multiple slaves can be present at a time, but only one master can exist. The master determines the slave to communicate through the chip select line. This requires the slave's MISO port to have a tri-state characteristic such that the port line exhibits high impedance when the device is not gated.

2. Data transmission

In one SPI clock cycle, the following operations are performed: 1) The host sends 1-bit data through the MOSI line, and the slave reads the 1-bit data through the line; 2) The slave transmits 1-bit data through the MISO line, and the host passes the The line reads this 1-bit data. This is done through the shift register. As shown in Figure 2, the master and slave each have a shift register, and the two are connected in a loop. With the clock pulse, the data is sequentially shifted out of the master and slave registers in order from high to low, and sequentially into the slave and master registers. When the contents of the register are all removed, it is equivalent to completing the exchange of the contents of the two registers.

3. Clock polarity and clock phase

The two most important settings in SPI operation are clock polarity (CPOL or UCCKPL) and clock phase (CPHA or UCCKPH). The clock polarity sets the level at which the clock is idle, and the clock phase sets the clock edge for reading data and transmitting data. The data transmitted by the master and the slave are completed at the same time, and the received data of both is also completed at the same time. Therefore, in order to ensure the correct communication between the master and the slave, their SPI should have the same clock polarity and clock phase. For example, the MSP430 controller and the OLED driver SH1101A are selected as master and slave, respectively, and Figures 3 and 4 show their SPI timing. As can be seen from Figure 4, when the SH1101A's SPI clock is idle and is high, and the data is received on the trailing clock edge, the MSP430 controller SPI settings should be consistent with this. As can be seen from Figure 3, to make the clock high when idle, UCCKPL should be set to 1; to enable data to be received on the trailing clock edge, UCCKPH should be cleared.

SPI interface concept, data transfer, clock polarity, clock phase, and pros and cons

4. Advantages and Disadvantages The SPI interface has the following advantages: 1) full-duplex operation; 2) simple operation; 3) high data transfer rate. At the same time, it also has the following disadvantages: 1) It needs to occupy more ports of the host (each slave needs a chip select line); 2) only supports a single host.

Circulating Fan

Dongguan Deli Plastic Co.,Ltd is a manufacturer specialized in the research, development ,plastic injection mould and making mass production with well-equipped facilities and strong technical force.

Our products are extensively used in household industry/electronic industry/automobile industry/building industry and other industries.


We have rich experience on one-stop solution, provide various services from new product design,prototype,mold making,mass production,assembly and logistics. The most important advantage is we have our own R&D team to help clients to turn ideas into actual parts. All of these engineers and designers have over 15 years experience in these plastic products fields.

We have a strict quality control system, an excellent management team and also a dedicated sales force, enable us to fulfill our commitment in high quality products and outstanding services.
If you are looking for a trustworthy supplier of customized items, please do not hesitate to contact us. We are always striving to establish a win-win partnership with customers from all over the world and help our partners to stay one step in front of your competitors.

Circulating Fan,Circulating Usb Fan,Circulating Mini Handy Fan,Desktop Circulating Small Fan

Dongguan Yuhua Electronic Plastic Technology Co.,Ltd , https://www.yuhuaportablefan.com