Super detailed RS232/RS485 circuit design

Table of contents

1 Introduction to UART

1.1 UART features and problems

1.2 UART protocol

2 Basic concepts of RS232 and RS485

3 RS232, RS485 interface standard

3.1 RS232 interface standard and features

3.1.1 RS232 interface standard

3.1.2 RS232 interface features

3.2 RS485 interface standard and features

3.2.1 RS485 interface standard

3.2.2 RS485 interface features

4 RS232, RS485 schematic design

4.1 SIT3232E-RS232 transceiver application

4.1.1 Features and Functional Block Diagram

4.1.2 Pin definition and electrical characteristics

4.1.3 Bus status and chip application points

4.2 SIT3485E-RS485 transceiver application

4.2.1 Features and Functional Block Diagram

4.2.2 Pin definition and electrical characteristics

4.2.3 Bus status and chip application points

5 RS232, RS485 data and chip selection recommendation

1 Introduction to UART

1.1 UART features and problems

UART universal asynchronous transceiver, serial, asynchronous communication bus, the bus has two data lines TX, RX, which can realize full-duplex transmission and reception, and is mainly used for communication between the host and peripherals.

Serial communication: transmit 1 bit at a time

Parallel communication: transfer multiple bits at a time

Simplex communication: one-way transmission

Two-way communication: two-way transmission, half-duplex: not at the same time, full-duplex: at the same time

Synchronous communication: have a common reference clock

Asynchronous communication: no common reference clock , transmission at a fixed baud rate

Baud rate: describes the communication rate of the serial port, the unit is bps, that is, the number of bits transmitted per second

UART frame format:

 

UART hardware connection:

Problems with UART communication:

(1) The electrical interface is not uniform, UART only defines the signal timing, the electrical characteristics of the interface are not defined, and there is no connector standard.

(2) UART generally uses the interface level of the chip itself. If it is not uniform, it may be TTL level, 3.3V or 1.8V, or CMOS level, which is difficult to connect directly.

(3) Poor anti-interference ability, single-ended transmission.

(4) The communication distance is short, and generally it can only communicate within the board.

Therefore, RS232 and RS485 interfaces are generally used for communication.

1.2 UART protocol

Detailed definition of the format frame of UART transmission data

Send low-order data first before sending high-order data.

For a detailed description, please refer to the article:

The most detailed communication protocol UART protocol analysis here is the serial port, RS232, RS485 and other buses, and the internal use is basically the UART protocol. (dreamsourcelab.cn)

2 Basic concepts of RS232 and RS485

Since the input of the UART protocol layer is a logic 0/1 signal, the logic 0/1 signal can be distinguished by different level standards at the physical layer. For different communication requirements, different physical layer implementations can be used. For example, simple intra-board communication, or common device debugging scenarios, use simple LVTTL/TTL levels to perform UART protocol communication between two devices.

  

The common serial port uses RS232 level, which can increase the transmission distance and resist a certain degree of signal interference. The cost paid is that the corresponding level conversion chip is required to realize the physical layer. The sending end needs to convert the internal high and low level signals into a +/- voltage signal with a higher voltage, and the receiving end needs to convert the +/- voltage signal into internal high and low level signals.

In the scenario of industrial communication, in order to further increase the transmission distance and enhance the reliability of the signal, the RS485 level standard is generally adopted. At the sending end, the ordinary high and low level signals are converted into a pair of differential signals, and at the receiving end, the differential signals are converted into ordinary high and low level signals. In addition, RS485 allows up to 128 transceivers to be connected to the bus, while TTL or RS232 is a point-to-point connection.

 

3 RS232, RS485 interface standard

RS232/RS485 is one of the serial data communication interface standards established by the TIA/EIA Telecommunications Electronics Industry Association, and is widely used in serial peripheral interface connections.

3.1 RS232 interface standard and features

3.1.1 RS232 interface standard

TIA/EIA-232-F (RS-232), RS means that it is a recommended interface standard, and there are many other interface standards.

TIA/EIA-232-F is the oldest and best known DTE/DCE interface standard (1970). It is a complete standard specifying the mechanical (connector), electrical (driver/receiver characteristics) and functional (circuit definition) requirements for a serial binary DT E/DCE interface . On the electrical side, the standard specifies an unbalanced, unidirectional point-to-point interface . The driver features a controllable baud rate, which allows the cable to be viewed as a lumped load rather than a transmission line. This is due to the drive transition time being much greater than the cable delay (speed x length). The driver's maximum capacitive load is specified at 2500pF . The standard allows up to 20 kbps (19.2 kbps) operation. For higher data rates, TIA/EIA-562 or TIA/EIA-423-B is recommended. Figure 3 illustrates a typical application and Table 1 lists the main electrical requirements. The main features of this standard are:

(1) single-ended

(2) Point-to-point interface

(3) Large polarity driver output swing

(4) The baud rate controlled by the driver

(5) Fully defined interface

(6) 20 kbps maximum data rate

3.1.2 RS232 interface features

The RS232 serial port has been simplified from 25 frames to 9 frames. Now it usually uses three wires RX, TX, and GND. The standard connector is a male and female DB9 connector. Usually transfer a large amount of data will use 9 lines, use less.

Transmission signal voltage level:

Binary 0: +5 ~ +15 Vdc

(called "space" or "on")

Binary 1: -5 to -15 Vdc

(called "mark" or "off")

Receive signal voltage level:

Binary 0: +3 ~ +32 Vdc

Binary 1: -3 to -30 Vdc

Data Format:

Start bit: binary 0

Data: 5, 6, 7 or 8 bits

Parity: odd, even, mark or

space (not for 8-bit data)

Stop bit: Binary 1, one or two bits

 

 

 

 

3.2 RS485 interface standard and features

3.2.1 RS485 interface standard

TIA/EIA-485-A is an electrical standard that specifies balanced drivers and receivers. It provides all the advantages of TIA/EIA-422-B, and supports multiple driver operation. TIA/EIA-485-A is currently the only TIA/EIA standard that allows multiple drive operations. This protocol allows for multipoint (party line) configurations. This standard specifies a bidirectional (half-duplex), multipoint interface. Figure 9 illustrates a typical multipoint application, and Table 6 lists the main electrical requirements.

The main functions are:

(1) Balanced interface

(2) Multi-point operation

(3) Operate from a single +5V power supply

(4) −7V to +12V bus common mode range

(5) There are up to 32 transceiver loads (unit load)

(6) Maximum 10 Mbps data rate (@ 40 feet) 15 meters

(7) Maximum cable length is 4000 feet (@ 100 kbps) 1500 meters

3.2.2 RS485 interface features

RS485 does not define a standard DB9 interface like RS232, it does not define a standard interface, and different connectors can be used according to specific project interface requirements.

RS485 is designed for complex industrial environments. Compared with the physical layer of other UART protocols, the biggest feature of RS485 bus is the use of differential signal transmission. Before the signal is sent, the single-ended signal is converted into a differential signal through the RS485 transceiver, and then sent to the bus for transmission; also before receiving, the differential signal on the bus is converted into a single-ended signal by the transceiver and then sent to the UART The controller receives it. On the RS485 bus, if you want full-duplex two-way communication, you need two pairs of differential signal lines (that is, 4 signal lines). If only half-duplex two-way communication is performed, only one pair of differential signals is required.

 

4 RS232, RS485 schematic design

4.1 SIT3232E-RS232 transceiver application

3.3V power supply, dual channel, up to 120kbps data rate. Now the device data rate is generally higher than the interface standard 20kbps, which is likely to be related to the load conditions of the test. If the maximum load is 20kbps at 2500pF, the rate can be increased at 1000pF.

4.1.1 Features and Functional Block Diagram

Functional block diagram:

 

3.3V power supply, two TTL/CMOS levels are converted to RS232 levels, and each transceiver can be used independently. Low power consumption, 2mA supply current.

There is no pull-up resistor inside T1IN/T2IN, and the unused T1IN/T2IN is connected to VCC or GND.

4.1.2 Pin definition and electrical characteristics

Pin definition:

 

Please refer to the manual for details, and pay attention to the connection of unused T1IN/T2IN to VCC or GND.

Electrical characteristics: voltage, current, power consumption

3.3V power supply, 760mW power consumption. If the controller is a 1.8V level UART, you cannot use this device, and you need to find an RS232 device that can supply 1.8V.

4.1.3 Bus status and chip application points

Logic level:

 Precautions:

(1) 3.3V power supply, unused driver input pins should not be suspended.

(2) The RS232 transceiver is equivalent to a level conversion chip. TX is connected to UART controller TX.

(3) Schematic diagram:

4.2 SIT3485E-RS485 transceiver application

3.3V power supply, the highest data rate is 12Mbps, allowing up to 256 devices to be connected to the bus. It is an RS-485 transceiver that fully meets the requirements of the TIA/EIA-485 standard.

4.2.1 Features and Functional Block Diagram

Functional block diagram:

 

4.2.2 Pin definition and electrical characteristics

Pin definition:

 

Electrical characteristics: voltage, current, power consumption

3.3V power supply, 400mW low power consumption device.

4.2.3 Bus status and chip application points

 Logic level:

Function table:

Precautions:

(1) Typical application:

 

(2) Schematic diagram:

5 RS232, RS485 data and chip selection recommendation

 Are you useless?

Hardware knowledge sharing, if you like it, please like, follow and add to favorites, if there is any infringement, please contact to delete! ! !

Guess you like

Origin blog.csdn.net/weixin_49336610/article/details/129466386