What is the principle of uart serial communication?
2022-07-22

What is the principle of uart serial communication? In embedded development, it is common to use a serial port to print debugging information. Sometimes, in order to save costs, there is no extra serial port. Therefore, uart serial communication will be used. So, what is the principle of uart serial communication? Let's learn more together!


Uart is a universal asynchronous transceiver and a serial communication method. Data is transmitted one by one during the transmission process. Serial communication has the advantages of fewer transmission lines and low cost, but the disadvantage is slow speed. Serial communication can be divided into two types: synchronous communication mode and asynchronous communication mode. But asynchronous communication mode is generally adopted, mainly because the receiving and sending clocks can be independent, which is conducive to improving the flexibility of sending and receiving. But asynchronous communication mode is generally adopted, mainly because the receiving and sending clocks can be independent, which is conducive to improving the flexibility of sending and receiving. Asynchronous communication is a character, followed by a character transmission, where a character's information consists of a start position, data position, parity verification position, and stop position.


The transmission of each character is synchronized through the starting position. The first character is the starting position, which begins to transmit along the notification receiver, followed by the data position. When transmitting, the low position is followed by the high position, and the character itself consists of 5-8 bit data positions. The data position is followed by an even number verification position, and finally a stop position. Mark the end of the character with a high level mark at the stop position and prepare for the transmission of the next character. After the stop position, there are free positions of different lengths. Both the stop position and idle position are specified as high levels to ensure that there is a falling edge at the starting position.


Extended Reading: Basic Structure of uart

(1) Output buffer register, which receives parallel data sent by the CPU from the data bus and stores it.

(2) Output shift register, which receives parallel data sent from the output buffer and moves the data bit by bit at the rate of sending the clock, converting parallel data into serial data output.

(3) Input shift register, which moves the data appearing on the serial data input line bit by bit at the rate of receiving the clock. When the data is full, it is sent in parallel to the input buffer register, which converts the serial data into parallel data.

(4) The input buffer register receives parallel data from the input shift register and is then retrieved by the CPU.

(5) Control register, which receives control words from the CPU, determines the transmission method and data format during communication based on the content of the control words. For example, whether to use asynchronous or synchronous mode, the number of data characters, whether there is parity, whether it is odd or even, and the number of stop bits.

(6) Status register. The status register stores various status information of the interface, such as whether the output buffer is empty and whether the input characters are ready. During the communication process, when a certain state is met, the state detection logic in the interface will set the corresponding position of the state register to '1' for the CPU to query.