Notes on serial communication in Linux

Source: Internet
Author: User
Article title: Notes on serial communication in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1. what is serial communication?

Serial communication refers to the serial transmission of data between the computer host and peripherals and between the host system and the host system. When using serial communication, each character sent and received is actually transmitted by one character at a time. each character is 1 or 0.

II. classification of serial communication

Serial communication can be divided into synchronous communication and asynchronous communication. Synchronous communication is based on software identification of synchronous characters to send and receive data. asynchronous communication is a type of communication that uses the character re-synchronization technology.

2.1 Synchronous communication

Synchronous communication is a continuous serial transmission of data. only one frame of information is transmitted at a time. The information frame here is different from the character frame in asynchronous communication. it usually contains several data characters.

Single synchronous character frame structure
+ ----- + ------ + ------- + ------ + ----- + -------- + ------- +
| Synchronization | data |... | data | CRC1 | CRC2 |
| Character 1 | character 2 | character 3 | character N |
+ ----- + ------ + ------- + ------ + ----- + -------- + ------- +
Double-synchronous character frame structure
+ ----- + -------- + ------ + ------- + --- + ------- + -------- +
| Synchronization | data |... | data | CRC1 | CRC2 |
| Character 1 | character 2 | character 1 | character 2 | character N |
+ ----- + -------- + ------ + ------- + --- + ------- + -------- +

They are composed of synchronization characters, data characters, and verification characters (CRC. The synchronization character is at the beginning of the frame and is used to confirm the start of the data character. There is no limit on the number of data characters after synchronization, which is determined by the length of the data block to be transferred. the verification characters include 1 to 2, it is used to verify the correctness of the character sequence received by the receiving end.

The disadvantage of synchronous communication is that the sending and receiving clocks must be strictly synchronized.

2.2 Asynchronous communication

In asynchronous communication, data is usually transmitted in character frames or byte units. The character frame is sent by the sender frame by frame and received by the receiving device frame by transmission line. The sender and acceptor can use their respective clocks to Control Data sending and receiving. These two clock sources are independent of each other and do not synchronize with each other.

When the receiving end detects the low-level logic "0" (that is, the start position of the character frame) sent over the transmission line, it determines that the sending end has started to send data. when the receiving end receives the stop position in the character frame, you will know that a frame of characters has been sent.

There are two important indicators in asynchronous traffic: the character frame format and the baud rate.

(1) character frame, which consists of the start bit, data bit, parity bit, and stop bit.

No idle character frame
+ -- + --- + -- +
| D7 | 0/1 | 1 | 0 | D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | 0/1 | 1 | 0 | D0 | D1 |
+ -- + --- + -- +
Parity
Check start and end
Bit
There are idle character frames
+ --- + -- +
| 1 | 0 | D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | 0/1 | 1 | 1 | 1 | 0 | D0 |
+ --- + -- +
Null, parity, and free space
START verification and end verification
Bit

Related Article

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.