Serial, UART, TTL, RS232, RS422, RS485 detailed explanation

    Serial Communication, It is the most basic communication method faced by electronic engineers. It refers to a communication method that transmits data in bits between peripherals and computers through data signal lines, ground lines, control lines, etc. This communication method uses fewer data lines and can save communication costs in long-distance communication, but its transmission speed is lower than that of parallel transmission.
    Serial communication includes: synchronous serial communication (USRT) and asynchronous serial communication (UART). However, many beginners often do not understand the connection and difference between UART and TTL, RS-232, RS-422, and RS-485. This article will discuss Talk about my understanding of these concepts and help you understand the relationship between them.
    What is UART? UART is a Universal Asynchronous Receiver/Transmitter, usually called UART, which is an asynchronous transceiver and a key module for asynchronous communication between devices. The UART is responsible for processing serial/parallel and parallel/serial conversion between the data bus and serial port, and specifies the frame format; as long as both parties use the same frame format and baud rate, they can use the same frame format and baud rate to not share the clock signal. , the communication process can be completed with only two signal lines (Rx and Tx), so it is also called asynchronous serial communication.
    TTL, RS-232, RS422, RS-485 refer to the level standard (electrical signal), many people refer to RS-232, RS-422, and RS-485 are mistakenly called communication protocols, which is very inappropriate. In fact, they are only a mechanical and electrical interface standard for UART communication (at most, the physical layer in the network protocol). . That is to say, the UART program is written for the MCU and other controllers, and the serial data will be sent and received between the devices through the hardware circuit. The hardware circuit must follow a level standard to realize the interaction between the devices.
    one, The TTL level stipulates that +5V is equivalent to logic "1", and 0V is equivalent to logic "0". Such a data communication and level specification method is called a TTL (transistor-transistor logic level) signal system.
    2. RS-232 is a serial physical interface standard formulated by EIA (Electronic Industry Association). RS is the abbreviation of "Recommended Standard" in English, and 232 is the identification number. RS-232 is a regulation on electrical characteristics and physical characteristics. It only acts on the transmission path of data, and it does not contain the processing method of data. The RS-232 standard is that logic 1 is -3V to -15V, and logic 0 is +3 to +15V.
    3. RS-485 standard, RS-232 interface can realize point-to-point communication, but this method cannot realize networking function. So, in order to solve this problem, a new standard RS-485 was created. The data signal of RS-485 adopts the differential transmission method, also known as balanced transmission, which uses a pair of twisted pair wires, one of which is defined as A, and the other is defined as B. Under normal circumstances, the positive level between the sending drivers A and B is +2 to +6V, which is a logic state, and the negative level is -2 to -6V, which is another logic state. There is also a signal ground C, and there is an "enable" terminal in RS-485, which is available or not in RS-422.
    Fourth, RS-422 standard, the electrical performance of RS-422 is exactly the same as that of RS-485. The main difference is that RS-422 has 4 signal lines: two for transmit and two for receive. Since the receiving and sending of RS-422 are separated, it can receive and send at the same time (full duplex), and because full duplex requires a separate channel for sending and receiving, RS-422 is suitable for communication between two stations. Star network and ring network cannot be used for bus network; RS-485 has only 2 signal lines, so it can only work in half-duplex mode, which is often used in bus network.
    Five, TTL level and RS232 level, USB conversion
    The PL2303 and CP2102 chips are USB to TTL serial port chips, and use USB to extend the serial port (TTL level). The following picture shows the PL2303 USB to TTL module

    MAX232芯片是 TTL电平与RS232电平的专用双向转换芯片,可以TTL转RS-232,也可以RS-232转TTL,下图为usb转ttl再转rs232模块

    六、RS-232与RS-485性能对比
    1.抗干扰性:RS485 接口是采用平衡驱动器和差分接收器的组合,抗噪声干扰性好。RS232 接口使用一根信号线和一根信号返回线而构成共地的传输形式,这种共地传输容易产生共模干扰。
    2.传输距离:RS485 接口的最大传输距离标准值为 1200 米(9600bps 时),实际上可达 3000 米。RS232 传输距离有限,最大传输距离标准值为 50 米,实际上也只能用在 15 米左右。
    3.通信能力:RS-485 接口在总线上是允许连接多达128个收发器,用户可以利用单一的 RS-485 接口方便地建立起设备网络。RS-232只允许一对一通信。
    4.传输速率:RS-232传输速率较低,在异步传输时,波特率为 20Kbps。RS-485 的数据最高传输速率为 10Mbps 。
    5.信号线:RS485 接口组成的半双工网络,一般只需二根信号线。RS-232 口一般只使用 RXD、TXD、GND 三条线 。
    6.电气电平值:RS-485的逻辑"1"以两线间的电压差为+(2-6) V 表示;逻辑"0"以两线间的电压差为-(2-6)V 表 示 。在 RS-232-C 中任何一条信号线的电压均为负逻辑关系。即:逻辑"1",-5- -15V;逻辑"0 " +5- +15V 。
串口是一种非常通用的设备接口,是仪器仪表设备常用的通信接口,常用于远程采集设备数据或者实现远程控制。串口的开发也比较简单,是很多工程师最喜欢的接口之一。
     七、RS-232、RS-422与RS-485比较
    RS485:2线式、半双工、点对多主从通讯(4线制因只能点对点已经淘汰)
    RS232:3线制、全双工、点对点通讯(因点对点通讯方式而无法联网,导致出现RS485)
    RS422:4线制、全双工、点对多主从通讯(实际上还有一根信号地线,共5根线)


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324660939&siteId=291194637