RS-485 and RS-232 share the interface circuit
By designing a shared interface circuit between RS-485 and RS-232, and using the electrical specification conversion chip of the USB conversion serial port module and the RS-485/RS-232 selection module, the unreliable connection between RS-485 and RS-232 in industrial applications is solved. solve the problem, achieve stable and reliable communication and flexible interface configuration, and simplify device management.
Patent Information
- Application Number
- CN202110840926.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-22
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-07-22
AI Technical Summary
The existing chip modules that convert RS-485 and RS-232 are not reliably connected in industrial applications, resulting in unstable communication links, increasing the complexity and size of the equipment, and making it difficult to adapt to the interface requirements of different electrical specifications.
Design an RS-485 and RS-232 shared interface circuit, convert the serial port module and RS-485/RS-232 selection module through USB, and use the electrical specification conversion chip to switch the interface mode according to the level status of the control signal to realize RS-485 Mode conversion with RS-232 avoids the use of external conversion modules.
It achieves stable and reliable communication between RS-485 and RS-232, enhances the interface flexibility and application scope of the device, reduces the number of interfaces, simplifies device management and maintenance, and avoids diversification problems caused by differences in interface types and quantities. .
Smart Images

Figure CN113722259B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of circuit technology, and in particular to a common interface circuit for RS-485 and RS-232. Background Art
[0002] In the related art, a converter module based on a chip that converts between RS-485 and RS-232 is used to solve the problem that there are both RS-485 interface devices and RS-232 interface devices in the running equipment. This type of converter can convert the TXD and RXD signals of the RS-232 serial port into the A and B signals of the half-duplex RS-485, and vice versa. However, the external conversion module method has the problem of unreliable connection, which leads to unstable communication link. Summary of the invention
[0003] In view of this, the present disclosure proposes a common interface circuit for RS-485 and RS-232.
[0004] Based on the above purpose, the present disclosure provides a RS-485 and RS-232 common interface circuit, including:
[0005] A USB-to-serial port conversion module, used for converting a first differential line pair and a second differential line pair of a bus interface into a standard serial port;
[0006] The RS-485 / RS-232 selection module is used to access the signal line led out by the standard serial port, and control the conversion between the RS-485 interface mode and the RS-232 interface mode according to the level state of the control signal of the signal line; wherein the RS-485 / RS-232 selection module includes an electrical specification conversion chip, and the electrical specification conversion chip includes a 485 / 232 control pin. In response to the control signal being in a high level state, the 485 / 232 control pin is in a low level state, so that the circuit works in the RS-232 interface mode; in response to the control signal being in a low level state, the 485 / 232 control pin is in a high level state, so that the circuit works in the RS-485 interface mode.
[0007] As can be seen from the above, the present disclosure provides a RS-485 and RS-232 shared interface circuit, including: a USB serial port conversion module, used to convert the first differential line pair and the second differential line pair of the bus interface into a standard serial port; an RS-485 / RS-232 selection module, used to access the signal line led out of the standard serial port, and control the conversion of the RS-485 interface mode and the RS-232 interface mode according to the level state of the control signal of the signal line; wherein the RS-485 / RS-232 selection module includes an electrical specification conversion chip, and the electrical specification conversion chip includes a 485 / 232 control pin, in response to the control signal being in a high level state, the 485 / 232 control pin is in a low level state, so that the circuit operates in the RS-232 interface mode; in response to the control signal being in a low level state, the 485 / 232 control pin is in a high level state, so that the circuit operates in the RS-485 interface mode. The control signal received by the RS-485 / RS-232 selection module controls the level state of the electrical specification conversion chip, solving the problem that RS-485 and RS-232 cannot share the same physical interface due to inconsistent electrical specifications. The main control processor of the aggregation device completes the functions of receiving and sending data and configuring the electrical specification conversion chip port as the RS-485 electrical specification interface and the RS-232 electrical specification interface through the USB device node of the read and write operation. While solving the problem that the same aggregation device can be used at the project construction site to access both RS-485 electrical specification interface devices and RS-232 electrical specification interface devices, modular interfaces can be configured as needed according to the number of device interfaces on site, enhancing the flexibility of the aggregation device access port, improving the ability of the aggregation device to access devices, and expanding the application scope of the aggregation device. The communication link is more stable and reliable without the need for an external conversion module. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only one or more embodiments of the present specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0009] Figure 1 An exemplary circuit diagram of an RS-485 and RS-232 shared interface circuit provided in an embodiment of the present disclosure.
[0010] Figure 2 Schematic diagram of the LTC2873 chip working mode switching according to an embodiment of the present disclosure.
[0011] Figure 3 Schematic diagram of a circuit of a USB to UART module according to an embodiment of the present disclosure.
[0012] Figure 4 Schematic diagram of a circuit of an RS-485 / RS-232 selection module according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0013] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0014] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in one or more embodiments of this specification should be understood by people with ordinary skills in the field to which the present disclosure belongs. The words "first", "second" and similar words used in one or more embodiments of this specification do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0015] As described in the background technology section, in the related art, a converter module based on a chip that converts between RS-485 and RS-232 is used to solve the problem that there are both RS-485 interface devices and RS-232 interface devices in the running equipment. This type of converter can convert the TXD and RXD signals of the RS-232 serial port into the A and B signals of the half-duplex RS-485, and vice versa. However, the external conversion module method has the problem of unreliable connection, which leads to unstable communication link.
[0016] In the field of electric power communications, the existing equipment in operation has both RS-485 and RS-232 interfaces. This situation adds physical interface requirements of different electrical specifications to the newly added aggregation equipment. Due to inconsistent application scenarios in different regions, it is difficult to unify the interfaces of aggregation equipment products, which will lead to diverse product models. After the implementation and deployment of the solution, it will also cause great trouble to the subsequent operation and maintenance. It is necessary to design a circuit with the same physical interface that can be configured on-site according to the actual application scenario. This not only solves the access requirements of the two electrical specifications of existing and new equipment, but also brings convenience to the subsequent operation and maintenance. At the same time, it also enhances the interface consistency of the aggregation equipment, which is convenient for product upgrades and maintenance.
[0017] There are existing converter module solutions based on chips that convert between RS-485 and RS-232. This type of converter can convert the TXD and RXD signals of the RS-232 serial port into the A and B signals of the half-duplex RS-485, and vice versa. Another solution is to design the main control board of the convergence device with both RS-485 and RS-232 interface circuits, and use their respective corresponding electrical interfaces to connect and communicate with the device.
[0018] The applicant has found that the existing mature RS-485 to RS-232 converter module solution is flexible and convenient to use during laboratory development and debugging, but in some industrial application sites, there will be certain safety hazards if this type of conversion module is plugged in to meet the needs of the application scenario. For example, when the convergence device only has an RS-485 interface but the on-site stock equipment only has an RS-232 interface, because the conversion module cannot be directly installed inside the convergence device housing, if the installation method of the external conversion module is adopted, although it can meet the interface conversion requirements on site, this external conversion module method has problems such as unstable and unreliable connection, which leads to unstable and unreliable communication links, which is unacceptable and unusable in the field of power communication.
[0019] Designing RS-485 and RS-232 interface circuits on the main control board of the aggregation device and then using two different electrical interfaces has the following disadvantages: first, it increases the number of circuit board components and PCB area; second, using different electrical physical interfaces increases the number of interfaces and the overall size of the equipment; third, it is difficult for the main control device of the aggregation device to adapt to the interface requirements of the existing equipment on the industrial site at any time, which will lead to the phenomenon of multiple models of aggregation devices due to differences in interface type and number of interfaces, which is not conducive to the unified management and upgrade and maintenance of the subsequent aggregation equipment.
[0020] In view of this, an embodiment of the present disclosure provides a common interface circuit for RS-485 and RS-232, including: a USB serial port conversion module, used to convert a first differential line pair and a second differential line pair of a bus interface into a standard serial port; an RS-485 / RS-232 selection module, used to access a signal line derived from the standard serial port, and control the conversion between the RS-485 interface mode and the RS-232 interface mode according to the level state of a control signal of the signal line; wherein the RS-485 / RS-232 selection module includes an electrical specification conversion chip, and the electrical specification conversion chip includes a 485 / 232 control pin, in response to the control signal being in a high level state, the 485 / 232 control pin is in a low level state, so that the circuit operates in the RS-232 interface mode; in response to the control signal being in a low level state, the 485 / 232 control pin is in a high level state, so that the circuit operates in the RS-485 interface mode.
[0021] An RS-485 and RS-232 common interface circuit provided by an embodiment of the present disclosure includes: a USB serial port conversion module, used to convert a first differential line pair and a second differential line pair of a bus interface into a standard serial port; an RS-485 / RS-232 selection module, used to access a signal line derived from the standard serial port, and control the conversion between the RS-485 interface mode and the RS-232 interface mode according to the level state of a control signal of the signal line; wherein the RS-485 / RS-232 selection module includes an electrical specification conversion chip, and the electrical specification conversion chip includes a 485 / 232 control pin, in response to the control signal being in a high level state, the 485 / 232 control pin is in a low level state, so that the circuit operates in the RS-232 interface mode; in response to the control signal being in a low level state, the 485 / 232 control pin is in a high level state, so that the circuit operates in the RS-485 interface mode. The control signal received by the RS-485 / RS-232 selection module controls the level state of the electrical specification conversion chip, solving the problem that RS-485 and RS-232 cannot share the same physical interface due to inconsistent electrical specifications. The main control processor of the aggregation device completes the functions of receiving and sending data and configuring the electrical specification conversion chip port as the RS-485 electrical specification interface and the RS-232 electrical specification interface through the USB device node of the read and write operation. While solving the problem that the same aggregation device can be used at the project construction site to access both RS-485 electrical specification interface devices and RS-232 electrical specification interface devices, modular interfaces can be configured as needed according to the number of device interfaces on site, enhancing the flexibility of the aggregation device access port, improving the ability of the aggregation device to access devices, and expanding the application scope of the aggregation device. The communication link is more stable and reliable without the need for an external conversion module.
[0022] The glossary is explained as follows:
[0023] RS-485---serial communication standard;
[0024] RS-232---serial communication standard;
[0025] TXD---Transmit Data sends data (signal);
[0026] RXD---Receive Data receives data (signal);
[0027] PCB---Printed Circuit Board;
[0028] DTR---Data Terminal Ready digital terminal ready (signal);
[0029] SPDT---Single Pole Double Throw single pole double throw switch;
[0030] NOT---NOT gate;
[0031] DI---Digital Input;
[0032] DO---Digital Output;
[0033] PullUp---Pull up (resistance);
[0034] PullDown---pull down (resistance);
[0035] ESD---Electro-Static discharge;
[0036] EEPROM---Electrically Erasable Programmable read only memory;
[0037] Mini-PCIE---Interface based on PCI-E bus;
[0038] USB---Universal Serial Bus;
[0039] SN---Serial Number product serial number;
[0040] TVS---Transient Voltage Suppressor transient diode;
[0041] FUSE---fuse;
[0042] GDT---Gas Discharge Tubes ceramic gas discharge tube.
[0043] The technical solution of the present disclosure is further described in detail below through specific embodiments.
[0044] refer to Figure 1, an RS-485 and RS-232 common interface circuit provided by an embodiment of the present disclosure includes: a USB-to-serial port conversion module, which is used to convert the first differential line pair and the second differential line pair of the bus interface into a standard serial port. Among them, the USB-to-serial port conversion module includes a TVS protection device (Transient Voltage Suppressor, also known as a transient diode), and a USB_UART chip connected to the TVS protection device and the Mini-PCIE interface (also known as an interface based on the PCI-E bus) respectively. The entire circuit is a board-type module, based on the USB2.0 specification protocol, and the Mini-PCIE interface used supports hot-swap operations.
[0045] In some optional embodiments, Figure 1 The first differential line pair USB_P and the second differential line pair USB_N of the Mini-PCIE interface are connected to the USB_UART chip on the board, realizing the function of converting USB to 4-way standard UART serial port. The TVS protection device on the differential line pair is used to protect the board interface circuit and improve the safety of the board hot plug operation.
[0046] In some optional implementations, the board communicates with the aggregation device master controller using USB, and the board is identified in the master controller's device directory / dev as: / dev / ttyUSB0, / dev / ttyUSB1, / dev / ttyUSB2, and / dev / ttyUSB4. By writing the configuration through the unified file read interface function write() of the Linux operating system, the board is configured to work in RS485 or RS232 mode in software, and the data to be sent is written to send data externally; the data is read through the read interface function read().
[0047] It should be noted that the circuit also includes an RS-485 / RS-232 selection module, which is used to access the signal line led out by the standard serial port, and control the conversion between the RS-485 interface mode and the RS-232 interface mode according to the level state of the control signal of the signal line; wherein the RS-485 / RS-232 selection module includes an electrical specification conversion chip, and the electrical specification conversion chip includes a 485 / 232 control pin, in response to the control signal being in a high level state, the 485 / 232 control pin is in a low level state, so that the circuit operates in the RS-232 interface mode; in response to the control signal being in a low level state, the 485 / 232 control pin is in a high level state, so that the circuit operates in the RS-485 interface mode.
[0048] In some optional implementations, the electrical specification conversion chip may be an LTC2873 chip.
[0049] Specifically, the TXD, RXD and DTR signal lines drawn from the standard serial port first pass through the isolation chip, and then the DTR signal line is connected to the 485 / 232 input control selection pin of the LTC2873 chip through the NOT gate. When the DTR control signal is high, the 485 / 232 control pin of the LTC2873 is low, and the circuit works in RS-232 mode; when the DTR control signal is low, the 485 / 232 control pin of the LTC2873 is high, and the circuit works in RS-485 mode.
[0050] refer to Figure 2 , the working mode of the LTC2873 chip as an electrical specification conversion chip includes: the LTC2873 data output RO (a total of 4) pins are directly connected to the serial port RXD (1,2,3,4) pins of the USB-UART chip after passing through the isolation chip. In order to ensure that the LTC2873 chip is in the state of receiving data when idle, it is necessary to use the TXD (1,2,3,4) pin of the USB-UART chip to connect to the #RE485 and DE485 / F232 pins of the LTC2873 after logical control. The TXD pin first passes through the isolation chip to split the signal into two: one way through Figure 1 The SPDT single-pole double-throw analog switch (i.e. the first switch) in the upper left middle part is connected to the B2 input pin, the SPDT output pin A is connected to the A input of the NOT gate, and the output Y of the NOT is connected to the #RE485 and DE485 / F232 input pins of the LTC2873; the other path is connected to the B2 input pin, the SPDT output pin A is connected to the A input of the NOT gate, and the output Y of the NOT gate is connected to the #RE485 and DE485 / F232 input pins of the LTC2873. Figure 1 The SPDT single-pole double-throw analog switch (i.e., the second switch) in the lower left center is connected to the B1 input pin, and the SPDT output pin A is connected to the DI input pin of the LTC2873. The LTC2873 external communication ports A / DO and B / RI are also connected to Figure 1 The A pins of the upper and lower two SPDT analog switches (i.e., the third switch and the fourth switch) in the middle right half. The four SPDT analog switches are connected to pull-up resistors PullUp or pull-down resistors PullDown, respectively, and their S input control terminals are connected to the output terminal Y signal line of DTR through the NOT gate.
[0051] In some optional embodiments, Figure 1 The SPDT in the upper left part is the first switch, the SPDT in the lower left part is the second switch, the SPDT in the upper right part is the third switch, the SPDT in the lower right part is the fourth switch, the lower NOT gate is the first NOT gate, and the upper NOT gate is the second NOT gate. In the circuit of the present application, the NOT gate can play the role of an inverter, or it can be replaced by an inverter.
[0052] Specifically, when the control signal DTR is logically 0, the first NOT gate will output a signal with a logic of 1 from the output terminal Y. At this time, the first switch connects to the input terminal B2, and the TXD signal is connected to the input terminal B2, output to the second NOT gate via the output terminal A, and output to the LTC2873 chip from the output terminal Y of the second NOT gate. The second switch connects to the input terminal S, and the logic of the input terminal S is 1, connects to the input terminal B2, connects to the first pull-down resistor from the input terminal B2, and the logic of the signal through the input terminal B2 and the output terminal A is 0. The third switch connects to the input terminal S, and the logic of the input terminal S is 1, connects to the input terminal B2, connects to the first pull-up resistor from the input terminal B2, and the logic of the signal through the input terminal B2 and the output terminal A is 1. The fourth switch connects to the input terminal S, and the logic of the input terminal S is 1, connects to the input terminal B2, connects to the second pull-down resistor from the input terminal B2, and the logic of the signal through the input terminal B2 and the output terminal A is 0.
[0053] In some optional embodiments, the electrical specification conversion chip includes a #RE485 pin, a DE485 / F232 pin, a DI pin, a RO pin, an A / DO (1-4 channels) pin, and a B / RI (1-4 channels) pin, wherein the #RE485 pin, the DE485 / F232 pin, the DI pin, and the RO pin are input pins, and the A / DO (1-4 channels) pin and the B / RI (1-4 channels) pin are output pins. When the TXD connected to the #RE485 pin and the DE485 / F232 pin of the electrical specification conversion chip is at a low level, transmission is enabled, and when the connected TXD is at a high level, reception is enabled. The DI pin is connected to the output terminal A of the second switch, so the logic of the DI pin is 0. The A / DO pin is at a high level at this time due to the signal output by the third switch and the effect of the first pull-up resistor, and the B / RI pin is at a low level at this time due to the output signal of the fourth switch and the effect of the second pull-down resistor.
[0054] It should be noted that when in RS-485 interface mode, the input and output logic of the LTC2873 chip includes:
[0055] When TXD is low level 0, the LTC2873 chip sends and enables, driving the output on the RS-485 bus to DI=0, that is, the output logic on the RS-485 bus is 0.
[0056] When TXD is high level 1, the LTC2873 chip is enabled to receive and does not drive the RS-485 bus. At this time, the logic level on the RS-485 bus is determined by A / DO-B / RI. When A / DO>B / RI, the logic is 1, and when A / DO<B / RI, the logic is 0. The output logic on the RS-485 bus is 1.
[0057] USB_UART outputs TXD as high level in idle state, so when LTC2873 works in RS-485 interface mode, the whole circuit is in receiving state.
[0058] In some optional embodiments, when the control signal DTR is 1, the input terminal A of the first NOT gate is connected to the DTR signal, and the logic of the signal is reversed to 0 at the output terminal Y, the first switch is connected to the input terminal S, and the signal with logic 0 is connected to be output via the output terminal Y of the first NOT gate, but because the input terminal B1 is connected to the second pull-up resistor, the logic of the output signal of the output terminal A is pulled up to 1. The second switch is connected to the input terminal S, and the logic is 0, and the input terminal B1 is connected to connect the TXD signal, which is output via the output terminal A. The third switch is connected to the input terminal S, and the logic is 0, and the input terminal B1 is connected, and because the connection is NC, it is equivalent to being unconnected. The fourth switch is similar to the third switch, the logic of the input terminal S is 0, and the output terminal A is equivalent to being unconnected. The #RE485 pin and DE485 / F232 pin of the LTC2873 chip are enabled for reception at this time, the DI pin accesses the TXD signal through the output terminal A of the second switch, the A / DO pin outputs the TXD signal accessed via the DI pin, and the B / RI pin outputs the RXD signal corresponding to the TXD signal.
[0059] It should be noted that when in RS-232 interface mode, the input and output logic of the LTC2873 chip includes: driving the A / DO output according to TXD, receiving B / RI as the input interface, and realizing the data sending and receiving function of the ordinary serial port.
[0060] In some optional embodiments, Figure 1 In the circuit diagram shown, the far right end is the external interface circuit of RS-485 and RS-232 and the triple protection circuit of high-voltage ceramic gas discharge tube GDT, FUSE fuse and TVS protection tube. The FUSE fuse completes the function of sharing the surge voltage when it is above the TVS starting voltage (for example, 50V) and below the GDT starting voltage (for example, 300V), so the surge protection design of the external interface is guaranteed.
[0061] refer to Figure 3, USB to serial port module, sends and receives USB signals through Mini-PCIE interface. USB signals are sensitive signals. After passing through ESD suppressor SRV05-4, part of the ESD interference on the line can be discharged through the internal ESD electrostatic diode; the two TVSs behind absorb the surge power of the line, further improving the anti-interference ability of the circuit; the USB to serial port chip is FT4232, which can output four-way UART serial port signals. In this design, each serial port only uses three signal lines: two data lines TXD and RXD, and DTR as the control signal of the subsequent circuit; 93LC46B is an EEPROM memory, which is used to store the configuration information of FT4232 such as SN number, so that the same aggregation device master can simultaneously identify multiple boards of this design, further improving the modularity of the aggregation device and the ability to increase the number of access devices; SG-310SCF is a 12MHz crystal oscillator, which provides a stable working clock for the module.
[0062] refer to Figure 4 , RS-485 / RS-232 selection module, by Figure 3 The four serial port signals output by the USB to serial port module are respectively output as RS-485 or RS-232 signals after passing through four identical mode selection circuits. The isolation chip can be selected as the chip with model number ADUM5401CRWZ. The isolation chip can isolate the TXD, RXD and DTR signals, and generate the isolated +5VDC voltage VDD_485 and ground signal VSS_485. The four serial port signals use four different power supplies and ground signals to improve the anti-interference performance. Referring to Table 1, the signals connected to each switch in different interface modes are different. The circuit after the isolator is the specific implementation of the function switching circuit: SPDT is a single-pole double-throw switch. When the S terminal is equal to logic "1", the A terminal and the B2 terminal are connected; when the S terminal is equal to logic "0", the A terminal and the B1 terminal are connected. The NOT gate can be replaced by an inverter. When the A terminal is logic "1", the Y terminal is logic "0"; when the A terminal is logic "0", the Y terminal is logic "1". LTC2873 is a 485 / 232 selection chip that converts serial port signals into RS-485 or RS-232 signals. The voltage range of logic 0 of RS-232 is +5V to +15V, and the voltage range of logic 1 is -5V to -15V; while the voltage difference between the A and B lines of RS-485 is -2V to -6V for logic 0, and +2V to +6V for logic 1. In order to ensure the electrical safety of the external interface, the DTR signal needs to be set to logic "1" by default. In this circuit, DTR is reversed through NOT as the control signal of the subsequent circuit, so the default state of this circuit is RS-232 mode.
[0063] Table 1 Relationship between control signal and control object
[0064]
[0065] In some optional implementations, in RS-485 interface mode, the signal logic control process for the DTR signal includes:
[0066] When DTR is logic "0" and is reversed to logic "1" after NOT, the 485 / 232 pin of LTC2873 is logic "1", and the chip works in RS-485 mode at this time; SPDT1 is controlled by this signal, connecting the B2 end and the A end, that is, the #RE485 and DE485 / F232 pins of LTC2873 are connected to the TXD signal; SPDT2 is controlled by this signal, connecting the B2 end and the A end, that is, the DI pin of LTC2873 is connected to a 1k pull-down resistor, and the logic is pulled down to "0". SPDT3 and SPDT4 are also controlled by this signal, connecting the B2 end and the A end, that is, the 485 bus output end of LTC2873 is connected to the 510R pull-up and pull-down resistors respectively, and the pull-up voltage is +3.3V.
[0067] The signal logic control process for the TXD signal includes:
[0068] When TXD sends logic "1", it is reversed to logic "0" after NOT, and #RE485 of LTC2873 is valid. The chip is in receiver mode under RS-485 mode. At this time, the output AB terminal is in high-impedance state, the pull-up resistor on the bus pulls bus A high, and the pull-down resistor pulls bus B low. The output differential line voltage difference AB is greater than +2V and less than +6V. At this time, the logic on the 485 bus is "1", that is, RS-485 sends "1".
[0069] When TXD sends logic "0", it is reversed to logic "1" after NOT, and the DE485 / F232 of LTC2873 is valid. The chip is in driver mode under 485 mode, and the bus output logic is driven to be logic "0" at the DI end. Since the chip's driving capability (-7V~+12V) is greater than the bus's pull-up and pull-down capabilities, the bus voltage difference can be normally driven to be greater than -6V and less than -2V. At this time, the logic on the 485 bus is "0", that is, RS-485 sends logic "0".
[0070] The signal logic control process for the RXD signal includes:
[0071] The chip is in receiver state by default. When the voltage difference of bus AB is less than 200mV, the RO pin, i.e., the RXD signal, receives logic "0". When the voltage difference of the bus is greater than 200mV, the RO pin, i.e., the RX signal, receives logic "1". The signal is sent directly to FT4232 through the isolator and then converted into a USB signal, which is then transmitted to the main controller of the aggregation device.
[0072] In some optional implementations, in RS-232 interface mode, the signal logic control process for the DTR signal includes:
[0073] The DTR signal is logic "1", which is reversed to logic "0" after NOT. The 485 / 232 pin of LTC2873 is logic "0", and the chip is in RS-232 mode; SPDT1 is controlled by this signal, connecting the B1 end and the A end, that is, the #RE485 and DE485 / F232 pins of LTC2873 are pulled high to logic "1" through a 1k pull-up resistor, and the RS-232 mode is selected as high-speed mode; SPDT2 is also controlled by this signal, connecting the B1 end and the A end, that is, the DI pin of LTC2873 is connected to the TXD signal, and the signal is directly sent out at the DO end of LTC2873 at the RS-232 level; SPDT3 and SPDT4 are also controlled by this signal, connecting the B1 end and the A end, that is, the output end of LTC2873 is disconnected from the pull-up resistor, which has no effect on the transmission of 232 signals. After the DO end of LTC2873 receives the RS-232 level, the serial port signal generated at the RO end is sent to the FT4232 through the isolator to be converted into a USB signal, and then transmitted to the main controller of the aggregation device.
[0074] In some optional embodiments, the electrical specification conversion chip also includes: #RE485 pin, DE485 / F232 pin and DI pin; the RS-485 / RS-232 selection module also includes: a first switch connected to the #RE485 pin and the DE485 / F232 pin, a second switch connected to the DI pin, a third switch, a fourth switch, a first 485 bus output terminal and a second 485 bus output terminal; wherein the third switch is connected to the first 485 bus output terminal, and the fourth switch is connected to the second 485 bus output terminal.
[0075] In some optional embodiments, the RS-485 / RS-232 selection module further includes: a first pull-down resistor connected to the second switch, a second pull-down resistor connected to the fourth switch, and a first pull-up resistor connected to the third switch; the signal line includes: a digital terminal ready signal line and a send data signal line; when the control signal output by the digital terminal ready signal line is logic 0, the control signal is reversed to logic 1 through the first inverter, and the first switch connects the send data signal line to the #RE485 pin and the DE485 / F232 pin; the second switch connects the first pull-down resistor to the DI pin, and pulls the logic of the above DI pin down to 0; the third switch connects the first pull-up resistor to the first 485 bus output end; the fourth switch connects the second pull-down resistor to the second 485 bus output end.
[0076] In some optional embodiments, when the sending logic of the data signal line is 1, the #RE485 pin is valid, the first 485 bus output terminal and the second 485 bus output terminal are in a high-impedance state, and the electrical specification conversion chip operates in the receiver mode under the RS-485 interface mode; wherein the electrical specification conversion chip is used to enable in the receiving circuit and does not drive the first 485 bus output terminal and the second 485 bus output terminal.
[0077] In some optional embodiments, when the data sending end signal line sends a logic of 0, the DE485 / F232 pin is valid, and the electrical specification conversion chip operates in the driver mode under the RS-485 interface mode; wherein the electrical specification conversion chip is used to send enable and drive the logic of the first 485 bus output end and the second 485 bus output end to 0.
[0078] In some optional embodiments, the RS-485 / RS-232 selection module further includes: a second pull-up resistor connected to the first switch; when the control signal output by the digital terminal ready signal line is logic 1, the control signal is reversed to logic 0 through the first inverter, and the 485 / 232 control pin is logic 0, and the first switch connects the second pull-up resistor to the #RE485 pin and the DE485 / F232 pin under the control of the control signal; the second switch connects the transmit data signal line to the DI pin under the control of the control signal; the third switch disconnects the first pull-up resistor connected to the output end of the first 485 bus under the control of the control signal; and the fourth switch disconnects the second pull-down resistor connected to the output end of the second 485 bus under the control of the control signal.
[0079] In some optional embodiments, the electrical specification conversion chip further includes: an A / DO pin connected to the output end of the first 485 bus and a B / RI pin connected to the output end of the second 485 bus; the electrical specification conversion chip in the RS-232 interface mode is used to drive the A / DO pin output according to the sending data signal line, and receive the B / RI pin as an input interface, and use the B / RI pin as a common serial port to send and receive data.
[0080] As can be seen from the above, the present disclosure provides a RS-485 and RS-232 shared interface circuit, including: a USB serial port conversion module, used to convert the first differential line pair and the second differential line pair of the bus interface into a standard serial port; an RS-485 / RS-232 selection module, used to access the signal line led out of the standard serial port, and control the conversion of the RS-485 interface mode and the RS-232 interface mode according to the level state of the control signal of the signal line; wherein the RS-485 / RS-232 selection module includes an electrical specification conversion chip, and the electrical specification conversion chip includes a 485 / 232 control pin, in response to the control signal being in a high level state, the 485 / 232 control pin is in a low level state, so that the circuit operates in the RS-232 interface mode; in response to the control signal being in a low level state, the 485 / 232 control pin is in a high level state, so that the circuit operates in the RS-485 interface mode. The control signal received by the RS-485 / RS-232 selection module controls the level state of the electrical specification conversion chip, solving the problem that RS-485 and RS-232 cannot share the same physical interface due to inconsistent electrical specifications. The main control processor of the aggregation device completes the functions of receiving and sending data and configuring the electrical specification conversion chip port as the RS-485 electrical specification interface and the RS-232 electrical specification interface through the USB device node of the read and write operation. While solving the problem that the same aggregation device can be used at the project construction site to access both RS-485 electrical specification interface devices and RS-232 electrical specification interface devices, modular interfaces can be configured as needed according to the number of device interfaces on site, enhancing the flexibility of the aggregation device access port, improving the ability of the aggregation device to access devices, and expanding the application scope of the aggregation device. The communication link is more stable and reliable without the need for an external conversion module.
[0081] An RS-485 and RS-232 shared interface circuit provided in the embodiments of the present invention can reduce the number of interfaces and prevent the phenomenon of RS-485 and RS-232 being connected incorrectly to each other; the modular design concept can support hot plugging and has high flexibility; the interface is simple and can support remote modification of the interface working mode, which is convenient for deployment on construction sites; the convergence device interface is unified and supports remote upgrades and equipment management and maintenance.
[0082] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0083] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0084] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0085] In addition, to simplify the description and discussion, and in order not to obscure the present disclosure, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the devices may be shown in the form of block diagrams to avoid obscuring the present disclosure, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the present disclosure will be implemented (i.e., these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that the present disclosure may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0086] While the disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications and variations of these embodiments will be apparent to those skilled in the art in light of the foregoing description.
[0087] The present disclosure is intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. A common interface circuit for RS-485 and RS-232, wherein: include: A USB-to-serial port conversion module, used for converting a first differential line pair and a second differential line pair of a bus interface into a standard serial port; An RS-485 / RS-232 selection module is used to access the signal line led out by the standard serial port, and control the conversion between the RS-485 interface mode and the RS-232 interface mode according to the level state of the control signal of the signal line; wherein the RS-485 / RS-232 selection module includes an electrical specification conversion chip, and the electrical specification conversion chip includes a 485 / 232 control pin, in response to the control signal being in a high level state, the 485 / 232 control pin is in a low level state, so that the circuit works in the RS-232 interface mode; in response to the control signal being in a low level state, the 485 / 232 control pin is in a high level state, so that the circuit works in the RS-485 interface mode; The RS-485 / RS-232 selection module further includes: an isolation chip; The isolation chip is used to isolate the signal line and generate isolated voltage and ground signals; The RS-485 / RS-232 selection module further includes: a first inverter connected to the isolation chip and the 485 / 232 control pin respectively; The control signal is set to logic 1 by default, and the control signal is connected to the 485 / 232 control pin through the first inverter to control the initial state of the circuit to the RS-232 interface mode; The electrical specification conversion chip also includes: #RE485 pin, DE485 / F232 pin and DI pin; the RS-485 / RS-232 selection module also includes: a first switch connected to the #RE485 pin and the DE485 / F232 pin, a second switch connected to the DI pin, a third switch, a fourth switch, a first 485 bus output terminal and a second 485 bus output terminal; wherein the third switch is connected to the first 485 bus output terminal, and the fourth switch is connected to the second 485 bus output terminal.
2. The circuit according to claim 1, wherein The RS-485 / RS-232 selection module further includes: a first pull-down resistor connected to the second switch, a second pull-down resistor connected to the fourth switch, and a first pull-up resistor connected to the third switch; The signal lines include: a digital terminal ready signal line and a send data signal line; When the control signal output by the digital terminal ready signal line is logic 0, the control signal is reversed to logic 1 through the first inverter, and the first switch connects the transmit data signal line to the #RE485 pin and the DE485 / F232 pin; the second switch connects the first pull-down resistor to the DI pin, and pulls the logic of the above DI pin down to 0; the third switch connects the first pull-up resistor to the first 485 bus output terminal; the fourth switch connects the second pull-down resistor to the second 485 bus output terminal.
3. The circuit according to claim 2, wherein: When the sending logic of the data signal line is 1, the #RE485 pin is valid, the first 485 bus output terminal and the second 485 bus output terminal are in a high-impedance state, and the electrical specification conversion chip operates in the receiver mode under the RS-485 interface mode; wherein, the electrical specification conversion chip is used to enable in the receiving circuit, and does not drive the first 485 bus output terminal and the second 485 bus output terminal.
4. The circuit according to claim 3, wherein: When the sending logic of the data signal line is 0, the DE485 / F232 pin is valid, and the electrical specification conversion chip works in the driver mode under the RS-485 interface mode; wherein, the electrical specification conversion chip is used to send enable, driving the logic of the first 485 bus output terminal and the second 485 bus output terminal to 0.
5. The circuit according to claim 2, wherein: The RS-485 / RS-232 selection module further includes: a second pull-up resistor connected to the first switch; When the control signal output by the digital terminal ready signal line is logic 1, the control signal is reversed to logic 0 through the first inverter, the 485 / 232 control pin is logic 0, and the first switch, under the control of the control signal, connects the second pull-up resistor to the #RE485 pin and the DE485 / F232 pin; the second switch, under the control of the control signal, connects the transmit data signal line to the DI pin; the third switch, under the control of the control signal, disconnects the first pull-up resistor connected to the output end of the first 485 bus; the fourth switch, under the control of the control signal, disconnects the second pull-down resistor connected to the output end of the second 485 bus.
6. The circuit according to claim 2, wherein: The electrical specification conversion chip also includes: an A / DO pin connected to the output end of the first 485 bus and a B / RI pin connected to the output end of the second 485 bus; The electrical specification conversion chip in the RS-232 interface mode is used to drive the A / DO pin output according to the sending data signal line, and receive the B / RI pin as an input interface, and use the B / RI pin as a common serial port to send and receive data.
7. The circuit according to claim 1, wherein: The electrical specification conversion chip is an LTC2873 chip.
