Serial protocol


1, serial communication and parallel communication
  by way of data transmission, communication and serial communication can be divided into parallel communication, serial communication means is a data signal line through a small number (typically 8 or less), between the ground and a control device signal lines, according to a data bit in the form of a transmission of communication data. Generally refers to communication in parallel using 8, 16, 32 and 64 or more data communication line transmission, they can correspond transmission comparative illustration below:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  Obviously, since a plurality of data bits can be transmitted in the same data transmission rate, the transmission amount of data is much greater parallel communication, serial communication can be saved and the cost of the hardware data lines ( especially far distance ) and  PCB  layout area, serial communication and parallel communication characteristics comparison table below:

 

 

 

 

 However, because of the synchronous parallel transmission are higher, and with the improvement of communication speed, the problem of signal interference can significantly affect the performance of communications, now with the development of technology, more and more applications using high-speed serial differential transmission rate . 

2,  full duplex, half duplex and simplex communication

  The direction of data communication, the communication is divided into full-duplex, half-duplex and simplex communication, they mainly square channel always distinguished, as shown below:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3,  synchronous communication and asynchronous communication

  The data synchronization method of communication, is divided into synchronous and asynchronous, to be used if there is a simple clock signal distinguished according to the process of communication.
In synchronous communications, a transceiver uses both the signal line represents a clock signal, a driving clock signal in both coordinate data synchronization, see below . Communication is usually two sides will unify the provisions of the rising edge of the clock signal or sampling the data line falling.  

 

 

 

 

 

 



 

 

  Is not used in an asynchronous data communication synchronizing clock signal, a synchronization are interspersed in the data signal directly in the signal bits, or the package body data, transmitting a data frame format data, see below , some communication further the two sides agreed to require the data transfer rate, in order to better synchronize  .

 

 

 

 

 

 


 

 

 

 

In the synchronous communication, the data signal content transmitted most of the data is valid, and the asynchronous communication frame will contain various identifiers, so higher efficiency synchronous communication, synchronous communication but allows both the clock error is small , whereas asynchronous communication allows both the clock error is larger.   

4,  the communication rate is
  a very important parameter to measure the communication performance is the communication rate, typically at the bit rate (the Bitrate) to indicate that the per second number of bits transmitted in bits per second ( 'bit / S) . Confusing concepts of the bit rate is "baud" (Baudrate) , which represents the number of transmission per symbol. And the concept of communications symbols signal modulation, commonly used in communications the same time period a binary number notation, such signals are referred to as symbols. As is common in the communications transmission, with  0V  represents a number  0 5V  represents a number  1 , then one symbol may represent two states  and  1 , the one symbol is equal to a binary bit, the baud rate at this time the size of the bit the same rate; if the communications transmission, there is  0V , 2V 4V  and  6V  represent a binary number  0001 10 11 , then each symbol can represent four states, i.e. two binary bits, so the number of symbols is half the number of bits of binary bits, this time the baud rate is half the bit rate. Because many common communication symbol two states are represented, people often come directly to the baud rate table shows the bit rate, although strictly speaking nothing wrong, but I hope you understand the difference between them.  
5, serial communications protocol Introduction to  serial communication (Serial Communication) is an inter-device very popular serial communication, because it is simple and convenient, most electronic devices support the communication, electronics engineers often use this when debugging equipment communication output debugging information.   In computer science, the most complex problems can all be simplified by stratification. The chip is divided into a core layer and an on-chip peripheral;  the STM32  standard library is a layer of software between the user and the register code. For the protocol, we are also in a hierarchical way to understand the most basic is to put it into physical layer and protocol layer. The physical layer communications system having predetermined mechanical characteristics, electronic functional parts, to ensure the transmission of the original data in the physical media. The main provisions of the protocol layer communication logic, unified send and receive both data packing, unpacking standards.


  5.1, the physical layer

  Serial communication physical layer standards and there are many variants, we mainly explain the RS-232, RS485, RS422 standard, which standard is mainly predetermined standard use level of the signal, and the signal communication interface.

  (1), communication interface 

 

 

 





  (2), level criteria

  The different communication standards use levels, serial communication can be divided into TTL standard, the RS-232 standard, RS485 standard, RS422 standard.

 

 

 

 

 

 

 

 

 

 

 

 

  Distinction RS232, RS485, RS422 as follows:

  5.2 protocol layer

  Packet transmitted by the serial communication device via its TXD interface transfer to the receiving device RXD interfaces. In the serial communication protocol layer, the provisions of the contents of the packet, it bit by the start, the main data, parity and stop bits composed of the two sides of the communication packet format to be agreed unanimously to send and receive data normally, its composition see below Figure:

 

 

 

 

   (1), the baud rate here is mainly on the asynchronous serial communication, asynchronous communication in the absence of the clock signal, it is necessary a good agreement between the two communication devices baud rate, i.e., the length of each symbol, so that the signal decoding, FIG. 20-6 by each cell is divided by imaginary lines representative of one symbol. Common baud rate of 4800 , 9600 , 115200 and so on.

  (2),  the communication start and stop signals   of a data packet serial communication start signal from the start until the end of the stop signal. Packet start signal by a logical 0 represented by data bits, the data packet stop signal by 0.5 , 1 , 1.5 or 2 logical 1 data bit representation, as long as both can be coincided.

  (3), valid data

  Content body data after the start bit is followed by the data packet to be transmitted, also referred to as valid data, valid data length is often agreed 5 , 6 , 7 , or . 8 bits long.

  (4),  data check

  After the valid data, an optional parity bit data. Since the data communication is relatively more susceptible to external interference leads to deviation of data transmission, we can solve this problem in the transmission plus parity. There odd parity check method (ODD) , even parity (the even) , 0 check (Space) , . 1 parity (Mark) , and no parity (noparity) , are as follows:

  odd parity check bit and valid data is required in the " 1 " bits will be odd, such as a . 8 -bit effective data length is: 01101001 , then total . 4 th " 1 " for odd parity to achieve the effect, parity bit is " 1 ", the most data will be transmitted . 8 bits of valid data plus 1 -bit parity bit total . 9 bits.

  even parity and odd parity in claim contrary, requires the frame data and parity bit of " 1 " s in an even number, such as a data frame: 11001010 , then the data frame " a number of" is . 4 th, so even parity bit is " 0 ."

  0 check is valid regardless of what the data is, the parity bit is always " 0 ", 1 parity check bit is always " 1 ."

  without verification, the packet does not contain a parity bit.

                              

Affect communication performance, and now with the development of technology, more and more applications using high-speed serial differential transmission rate. 

Guess you like

Origin www.cnblogs.com/The-explosion/p/11587930.html