Commonly used communication buses UART, I2C, SPI, serial parallel, half-duplex and full-duplex difference

This article uses a simple and vivid explanation to let everyone understand the common communication buses UART, I2C, SPI, and the difference between serial and parallel, and what full-duplex and half-duplex mean.

More technical articles focus on "Moyu IT", and the public account of "Moyu IT" is the first on the whole network.

Introduction to common communication methods

Table of contents

Serial Communication and Parallel Communication 

Synchronous and asynchronous communication 

Simplex communication, half duplex communication and full duplex communication 

Common Data Communication Buses 

baud rate 


Serial Communication and Parallel Communication 

Serial and parallel are distinguished according to the way of data transmitted each time. As the name implies, serial means that data is transmitted bit by bit sequentially, and parallel means that multiple bits of data are transmitted in parallel at the same time .

For example, the sender needs to send "010" three-digit data:

There is only one channel for serial communication, and serial communication requires "0", "1", and "0" to be transmitted in sequence.

In parallel communication, multiple channels send data at the same time. If the 3-bit data "010" is transmitted, the sending end sends "010" at the same time to complete the transmission.

Synchronous and asynchronous communication 

This is distinguished in serial communication. After all, parallel communication sends multiple sets of data at a time, and there is no problem of synchronization and asynchrony.

Synchronous serial communication requires clock line synchronization . In addition to data lines, the sender and receiver also need clock lines for synchronization, such as I2C bus.

Because there is a clock line, the sending end and the receiving end work under the same clock beat. After synchronous communication sends data, wait for the receiving end to send back a response before sending the next data.

Asynchronous serial communication does not have a clock line , but only contains start and end flag bit start/end related information in the sent data, and the receiving end uses a local clock for sampling according to the flag bits, such as a UART bus.

Asynchronous communication can send the next data without waiting for the response from the receiving end. Asynchronous communication does not have a unified clock beat, and communicates according to their own internal clock beats.

Simplex communication, half duplex communication and full duplex communication 

The difference between the three lies in the different transmission directions .

Simplex communication : data can only be transmitted from the sender to the receiver, and can only be transmitted in one direction. It can be understood as a one-way street, which only allows vehicles to travel in one direction. For example radio, remote control.

Half-duplex communication : Two-way transmission is possible, but sending and receiving cannot be performed at the same time, and only sending or receiving can be performed at the same time. That is, vehicles are allowed to travel in both directions, but vehicles are not allowed to travel in both directions at the same time. For example the I2C bus.

Full-duplex communication : supports two-way transmission, and can send and receive data at the same time. That is to allow vehicles to travel in both directions at the same time, and data can be transmitted between the transmitter and receiver at the same time. For example, UART bus, telephone (you can also receive the other party's speech while speaking).

Common Data Communication Buses 

UART bus : The full name is Universal Asynchronous Receiver Transmitter (Universal Asynchronous Receiver Transmitter), which is a serial asynchronous communication bus that can realize full-duplex data transmission.

The UART bus is composed of two data lines and a GND ground line. When the level changes from idle state (high level) to low level, it is the start bit of data transmission, and then data transmission starts. After the 8-bit data is transmitted, it changes from low level to high level, indicating the end.

I2C bus : It is a serial, half-duplex synchronous communication bus.

The specific content is introduced in the previous article -  the most commonly used communication protocol - I2C icon-default.png?t=N5K3http://mp.weixin.qq.com/s?__biz=MzkxNTUwMjc4Ng==&mid=2247483838&idx=1&sn=a31a0703925dd7d28b606e6024c15817&chksm=c15f6213f628 eb05e3fcc88458849df3dce11a380cc88b4750781ebbbef76a95a841ffd444af&scene=21#wechat_redirect

SPI bus : Serial Peripheral Interface (Serial Peripheral Interface), is a full-duplex synchronous communication bus.

It is a master multi-slave mode, a master (master) communicates with one or more slaves (slave). SPI communication requires 4 wires, namely:

SCLK: clock signal line. generated by the host.

MOSI: Master Output, Slave Input. The master device outputs data on this line, and the slave device receives data. That is, the master sends instructions to the slave.

MISO: Master Input, Slave Output. The master device receives the data sent by the slave device, which can also be understood as the master reads the status of the slave device.

CS: Slave chip select signal line. Which slave to communicate with is determined by the chip select signal.

The distinguishing characteristics of these three buses can be seen through this table.

baud rate 

For various communication methods, there is a concept to express the data rate, which is the baud rate, which measures the serial communication speed.

Baud Rate (Baud Rate), unit bps, it represents the number of bits sent per second.

If the baud rate of a serial port is 9600, it means that the serial port can send 9600 bits of data within one second. The transmission interval of each data is 104us.

1s / 9600 = 104us

Through the introduction of common communication bus types and differences, as well as some key concepts, do you have a basic understanding of communication? Through vividly learning a little knowledge, it is still full of gains.

Guess you like

Origin blog.csdn.net/qrx941017/article/details/131416104