UART Protocol Detailed

Source: Internet
Author: User

about UART
Universal Asynchronous Transceiver (Universal asynchronous Receiver/transmitter), commonly referred to as a UART. UART communication is quite common in the work, and the project needs to generate a UART signal, which is recorded in the blog. The UART is asynchronous communication because it has only one line to communicate with the data. Do not transmit signals synchronously, like SPI,I2C. So the transmission speed of the serial port is slower than the speed of other protocols. Here is a detailed explanation of some of the UART protocols and how to communicate.


Figure-1


Figure-2
The image above is a waveform schematic of the UART protocol that transmits a "a" character through the UART decoding of the oscilloscope. Follow this diagram to introduce some of the basic parameters of the UART.
baud rate: This parameter is easy to confuse with bit rate, in fact they are made from the difference. Specific can be more clear Baidu. But I think the baud rate in the UART can be considered a bit rate, which is the number of bits transmitted per second. General selection of baud rate will have 9600,19200,115200 and other options. In fact, it means to transmit so many bits per second (bit).
starting bit: A signal of logic "0" is emitted to indicate the beginning of the transmitted data.
Data bits: You can choose a value that has 5,6,7,8 these four values and can transmit so many bits with a value of 0 or 1. This parameter is preferably 8, because if this value is a different value when you transmit an ASCII value, the general parsing must be problematic. The reason is simple, an ASCII character value of 8 bits, if the data bit of a frame is 7, then another one is an indeterminate value, so there will be an error.
Check digit: After the data bits are added, the digits of "1" should be even (even parity) or odd (parity) to verify the correctness of the data transfer. For example, transfer "A" (01000001) for example.
1, when the odd check: "A" character of the 8 bit bit two 1, then parity bit 1 to meet the number of 1 is odd (odd check). The waveform of Figure 1 is the case.
2, when an even check: "A" character 8 bit bit two 1, then the parity bit is 0 to meet the number of 1 is even (even parity).
This bit can also be removed, i.e. no parity bits are required.
Stop Bit: It is the end flag for a frame of data. Can be 1bit, 1.5bit, 2bit of idle level. Maybe everyone will find it strange, how there are 1.5 people ~ Yes, indeed. So I used two waveform points to represent a bit when I was producing this UART signal. This can not be a deep dive ...
Idle bit: There is no level state on the line when data is transmitted. For logic 1.
Transmission Direction: Whether the data is transferred from the high (MSB) or the low (LSB) start. For example, the transmission "A" if it is the MSB is 01000001 (as shown in Figure 2), if it is an LSB then 10000010 (Figure-4 below)
The UART transmits the data in the order that it starts transmitting a starting bit, then transmits the data bit, then transmits the check bit (this bit is not required), and the last transmission stop bit. Such a frame of data is transmitted. Then it goes on like this. Here is a parameter to be said.
frame Interval: That is, the interval between the frame and the frame of the transfer data, can be measured in bits or time (know the baud rate so the number of bits and time can be converted). For example, after the transfer of "a", this is a frame of data, and then the "B", then the interval between a and B is the frame interval.

Figure-3


Figure-4
Both the data and the baud rate are the same on the two and the next two figures, but there are several parameters that are deliberately set back to form a contrast. Facilitates a deeper understanding of the UART.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.