Serial port distributor

Through the serial distributor that integrates the serial port receiving unit, sending unit and other modules, the problems of automatic detection and remote control of multiple serial links in the existing technology are solved, and the continuity of data transmission and system reliability are realized, and it is suitable for industrial automation and communication backup scenarios.

CN120256357APending Publication Date: 2025-07-04SHENYANG AERO-TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510562322.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing serial communication system is prone to interrupt data transmission when the main link fails, and lacks automatic detection and network remote control functions of multiple serial links, resulting in increased system reliability and operational complexity.

Method used

A serial port distributor is designed, integrating a serial port receiving unit, a sending unit, a network interface driver unit, a dial switch driver unit, a key driver unit, a power management unit and a relay driver unit. It uses the STM32F407ZET6 chip for control, realizes automatic detection and switching of multiple serial ports, and supports remote control.

Benefits of technology

It realizes automatic detection and handover of multiple RS232 serial links, ensures data transmission continuity, improves system reliability and anti-interference capabilities, and supports intelligent handover and remote control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256357A_ABST
    Figure CN120256357A_ABST
Patent Text Reader

Abstract

The invention relates to serial port equipment, in particular to a serial port distributor. The device comprises a serial port receiving unit, a serial port sending unit, a network interface driving unit, a dial switch driving unit, a key driving unit, a control unit U1, a power supply management unit and a relay driving unit. The control unit U1 is respectively connected with the serial port receiving unit, the serial port sending unit, the network interface driving unit, the dial switch driving unit, the key driving unit, the power supply management unit and the relay driving unit; and the relay driving unit is connected with the serial port sending unit. On the basis of a traditional serial port distributor, key modules such as level switch, power management, relay drive and network interfaces are optimized, the reliability and anti-jamming capability of a system are improved, and intelligent switching and remote control functions are supported.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to serial port devices, and in particular to a serial port distributor. Background Art

[0002] In modern industrial control and communication systems, serial port (RS232) devices are widely used in data transmission due to their simplicity and reliability. However, traditional serial port communication systems usually adopt a single communication link. Once the main link fails, data transmission will be interrupted, resulting in a reduction in system reliability. In addition, the prior art lacks a switching function for multiple serial port links. Users often need to manually intervene to switch to the backup link, which not only increases the operation complexity but also may cause data transmission delay or loss.

[0003] Most of the existing serial port distributors or switching devices have a single function and cannot support automatic detection and network remote control of multiple serial ports at the same time. Some devices support multiple serial port inputs but lack an automatic switching mechanism for data validity; others cannot quickly switch the link through a manual forced mode or achieve remote configuration and monitoring in a network environment. Therefore, there is an urgent need for a serial port distributor that can integrate multiple serial port management, automatic switching, forced selection, and network control functions to improve the reliability and flexibility of the system. Summary of the Invention

[0004] The present invention aims at the defects existing in the prior art and provides a serial port distributor.

[0005] To achieve the above object, the present invention adopts the following technical solutions. A serial port distributor includes a serial port receiving unit, a serial port sending unit, a network interface driving unit, a DIP switch driving unit, a key driving unit, a control unit U1, a power management unit, and a relay driving unit; the control unit U1 is respectively connected to the serial port receiving unit, the serial port sending unit, the network interface driving unit, the DIP switch driving unit, the key driving unit, the power management unit, and the relay driving unit; the relay driving unit is connected to the serial port sending unit.

[0006] Further, the control unit U1 includes a chip STM32F407ZET6; the I2C storage device is connected to the control unit U1 through the I2C1_SCL and I2C1_SDA pins.

[0007] Further, the serial port receiving unit includes a DB9 connector J2M-J5M, level conversion chips U4 and U5, and both level conversion chips U4 and U5 use the chip MAX3232. The 2nd pin of J2M is connected to the 8th pin of level conversion chip U5, the 3rd pin of J2M is connected to the 7th pin of level conversion chip U5, and the 5th pin of J2M is grounded. The 2nd pin of J3M is connected to the 13th pin of level conversion chip U5, the 3rd pin of J3M is connected to the 14th pin of level conversion chip U5, and the 5th pin of J3M is grounded. The 2nd pin of J4M is connected to the 8th pin of level conversion chip U4, the 3rd pin of J4M is connected to the 7th pin of level conversion chip U4, and the 5th pin of J4M is grounded. The 2nd pin of J5M is connected to the 13th pin of level conversion chip U4, the 3rd pin of J5M is connected to the 14th pin of level conversion chip U4, and the 5th pin of J5M is grounded. The 9th - 12th pins of level conversion chip U4 are respectively connected to the 113th pin, 112th pin, 129th pin, and 124th pin of control unit U1. The 9th - 12th pins of level conversion chip U5 are respectively connected to the 102nd pin, 101st pin, 113th pin, and 116th pin of control unit U1.

[0008] Further, the serial port transmitting unit includes a DB9 connector J1F and a level conversion chip U3. The level conversion chip U3 uses the chip MAX3232. The DB9 connector J1F is connected to the level conversion chip U3 through a signal line for converting between RS232 level and TTL level. Among them, the 2nd pin of the DB9 connector J1F is connected to the 14th pin of the level conversion chip U3; the 3rd pin of the DB9 connector J1F is connected to the 13th pin of the level conversion chip U3. The level conversion chip U3 is connected to the control unit U1 through a signal line for receiving and transmitting serial communication data. Among them, the 11th pin of the level conversion chip U3 is connected to the 77th pin of the control unit U1 for receiving external serial port data; the 12th pin of the level conversion chip U3 is connected to the 78th pin of the control unit U1 for transmitting data to an external serial port device.

[0009] Further, the relay driving unit includes a relay M1 and a triode Q1. The base of the triode Q1 is connected to the 56th pin of the control unit U1 for receiving a control signal to drive the relay. The 7th and 2nd pins of the relay contact are respectively connected to the 14th and 13th pins of the level conversion chip U3. The 6th and 3rd pins of the relay contact are respectively connected to the 8th and 7th pins of the level conversion chip U5.

[0010] Further, the button driving unit includes toggle switches K2 - K5 and LED indicators LED3 - LED11. The toggle switches are connected to the GPIO input ports of the control unit U1 through their respective independent pins for receiving user input signals. Among them, toggle switch K2 is connected to PE8 of U1; toggle switch K3 is connected to PE10 of U1; toggle switch K4 is connected to PE12 of U1; toggle switch K5 is connected to PE14 of U1. The LED indicators are connected to the GPIO output ports of the control unit U1 through their respective pins, and their on - off states are controlled by the control unit U1. Among them, LED3 is connected to PE9 of U1; LED4 is connected to PE11 of U1; LED5 is connected to PE13 of U1; LED6 is connected to PE15 of U1; LED7 to LED11 are respectively connected to PG1 to PG5 of U1.

[0011] Further, the DIP - switch driving unit includes DIP - switch S2. The 1st to 8th pins of DIP - switch S2 are respectively connected to the 10th to 19th pins of the control unit U1 as general - purpose input - output GPIO pins for configuring the working mode. The 9th to 16th pins of DIP - switch S2 are grounded, and a pull - down resistor is used to ensure the stable level in the unactivated state. The DIP - switch driving unit provides an input signal to the control unit U1 through the state change of the toggle switch for configuring the working mode or parameters of the system.

[0012] Further, the network interface driving unit includes network port RJ45 and chip LAN8720A. The network port RJ45 is connected to the LAN8720A chip through differential signal lines. Among them: pin 1 of RJ45 is connected to pin 21 of LAN8720A; pin 2 of RJ45 is connected to pin 20 of LAN8720A; pin 3 of RJ45 is connected to pin 23 of LAN8720A; pin 6 of RJ45 is connected to pin 22 of LAN8720A. LAN8720A is connected to the control unit U1 through the management interface and data interface. Among them: pin 12 of LAN8720A is connected to pin 36 of STM32F407ZET6; pin 13 of LAN8720A is connected to pin 27 of STM32F407ZET6; pins 17 and 18 of LAN8720A are respectively connected to pins 73 and 74 of STM32F407ZET6; pin 14 of LAN8720A is connected to pin 35 of STM32F407ZET6.

[0013] Further, the power management unit includes an input power interface J3, an input power interface J4, an LM2596S chip U2, and an LM2596S chip U9. The first pin +12V of the input power interface J3 is connected to the fuse F1 through a diode D1 and then accesses the VIN pin of the LM2596S chip U2. The LM2596S chip U2 is configured to reduce the input voltage to a stable 3.3V output. The first pin +12V of the input power interface J4 is directly connected to the VIN pin of the LM2596S chip U9 through a diode D2. The LM2596S chip U9 is configured to reduce the input voltage to a stable 5V output.

[0014] Beneficial effects of the present invention compared with the prior art.

[0015] The serial port allocator of the present invention is used for detecting multi-RS232 serial link signals. Through the automatic detection and switching function of the main link and the backup link, when the main link fails, the system can automatically switch to the backup link to ensure the continuity of data transmission and significantly improve the reliability of the system. It integrates a network interface drive unit to monitor the link status and send control commands, facilitating centralized management and maintenance.

[0016] Based on the traditional serial port allocator, the circuit structure of the present invention optimizes key modules such as level conversion, power management, relay drive, and network interface, not only improving the reliability and anti-interference ability of the system, but also supporting intelligent switching and remote control functions, and is applicable to scenarios with high requirements for stability such as industrial automation and communication backup. Brief Description of the Drawings

[0017] The present invention will be further described below in conjunction with the drawings and specific embodiments. The protection scope of the present invention is not limited only to the expressions of the following content.

[0018] Figure 1 It is the circuit diagram of the control unit U1 and the DIP switch unit.

[0019] Figure 2 It is the circuit diagram of the power management unit.

[0020] Figure 3 It is the circuit diagram of the network interface drive unit.

[0021] Figure 4 It is the circuit diagram of the memory U7.

[0022] Figure 5 It is the serial port and relay circuit Figure 1 。

[0023] Figure 6 It is the serial port and relay circuit Figure 2 。

[0024] Figure 7 It is the circuit diagram of the key driving unit.

[0025] Figures 8 - 10 is Figure 1 the partial enlarged schematic diagram of Specific embodiments

[0026] To make the objectives, technical solutions and beneficial effects of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention.

[0027] As Figures 1 - 10 shown, the serial port distributor includes a serial port receiving unit, a serial port sending unit, a network interface driving unit, a DIP switch driving unit, a key driving unit, a control unit U1, a power management unit, and a relay driving unit; the control unit U1 is respectively connected to the serial port receiving unit, the serial port sending unit, the network interface driving unit, the DIP switch driving unit, the key driving unit, the power management unit, and the relay driving unit; the relay driving unit is connected to the serial port sending unit.

[0028] Preferably, the control unit U1 includes the chip STM32F407ZET6.

[0029] Embodiment 1: The control unit U1 realizes the reception and transmission of serial port data through the USART pins, including: the 105th pin PA13 of U1 is connected to the 4th pin of J1, and the 109th pin PA14 of U1 is connected to the 6th pin of J1. The 48th pin of U1 is connected to the R5 resistor and then grounded. The 136th pin of U1 is connected to the 6th pin of U7. The 137th pin of U1 is connected to the 5th pin of U7. The 8th and 9th pins of U1 are connected to the crystal oscillator, the 115th pin of U1 is connected to S3, and the 138th pin of U1 is connected to R4. The 25th pin of U1 is connected to S1, the 23rd and 24th pins of U1 are connected to the 25M crystal oscillator, and the 56th pin of U1 is connected to Q1. And the I2C storage device is connected to the control unit through the I2C1_SCL and I2C1_SDA pins, specifically including: the PB6 pin (I2C1_SCL) and the PB7 pin (I2C1_SDA) are connected to the I2C memory (24C04, U7). The control unit realizes multi-channel serial port communication, network communication, relay control, and data reading and writing operations of the external memory through the above connection methods.

[0030] Preferably, the serial port receiving unit includes DB9 connectors J2M-J5M, level conversion chips U4 and U5, and both level conversion chips U4 and U5 use the chip MAX3232; the DB9 connectors J2M-J5M are connected to the level conversion chips U4 and U5 through signal lines for realizing the conversion between RS232 level and TTL level. The 2nd pin of J2M is connected to the 8th pin of level conversion chip U5, the 3rd pin of J2M is connected to the 7th pin of level conversion chip U5, and the 5th pin of J2M is grounded; the 2nd pin of J3M is connected to the 13th pin of level conversion chip U5, the 3rd pin of J3M is connected to the 14th pin of level conversion chip U5, and the 5th pin of J3M is grounded; the 2nd pin of J4M is connected to the 8th pin of level conversion chip U4, the 3rd pin of J4M is connected to the 7th pin of level conversion chip U4, and the 5th pin of J4M is grounded; the 2nd pin of J5M is connected to the 13th pin of level conversion chip U4, the 3rd pin of J5M is connected to the 14th pin of level conversion chip U4, and the 5th pin of J5M is grounded. The level conversion chips U4 and U5 are connected to the control unit through signal lines for transmitting the converted signals to the control unit for processing; the 9th-12th pins of level conversion chip U4 are respectively connected to the 113th pin, 112th pin, 129th pin, and 124th pin of control unit U1; the 9th-12th pins of level conversion chip U5 are respectively connected to the 102nd pin, 101st pin, 113th pin, and 116th pin of control unit U1; the serial port receiving unit receives the serial port data of external devices through multiple DB9 connectors, and after completing the adaptation between RS232 and TTL levels through the level conversion chips, transmits the data to the main control chip for processing.

[0031] That is, the connection summary: The 2nd and 3rd pins of J2M are connected to the 8th and 7th pins of U5, and the 5th pin of J2M is grounded. The 2nd and 3rd pins of JM3 are connected to the 13th and 14th pins of U5, and the 5th pin of J3M is grounded. The 2nd and 3rd pins of J4M are connected to the 8th and 7th pins of U4, and the 5th pin of J4M is grounded. The 2nd and 3rd pins of J5M are connected to the 13th and 14th pins of U4, and the 5th pin of J5M is grounded. The 9th, 10th, 11th, and 12th pins of U4 are respectively connected to the 113th, 112th, 129th, and 124th pins of U1. The 9th, 10th, 11th, and 12th pins of U5 are respectively connected to the 102nd, 101st, 113th, and 116th pins of U1.

[0032] Preferably, the serial port sending unit includes a DB9 connector J1F and a level conversion chip U3. The level conversion chip U3 uses the chip MAX3232. The DB9 connector J1F is connected to the level conversion chip U3 through a signal line to achieve the conversion between RS232 level and TTL level. Among them, pin 2 of the DB9 connector J1F is connected to pin 14 of the level conversion chip U3; pin 3 of the DB9 connector J1F is connected to pin 13 of the level conversion chip U3. The level conversion chip U3 is connected to the control unit U1 through a signal line to achieve the reception and transmission of serial communication data. Among them, pin 11 of the level conversion chip U3 is connected to pin 77 of the control unit U1 to receive external serial data; pin 12 of the level conversion chip U3 is connected to pin 78 of the control unit U1 to send data to an external serial device. The serial port sending unit is used to perform serial communication with an external device through the DB9 connector and complete the adaptation between RS232 and TTL levels through the level conversion chip.

[0033] More preferably, the relay driving unit includes a relay M1 and a triode Q1. The base of the triode Q1 is connected to pin 56 of the control unit U1 to receive a control signal to drive the relay; (The relay M1 realizes the connection switching between external devices through its contacts.) Pin 7 and pin 2 of the relay contacts are respectively connected to pin 14 and pin 13 of the level conversion chip U3 (serial port sending part); pin 6 and pin 3 of the relay contacts are respectively connected to pin 8 and pin 7 of the level conversion chip U5 (main link J2M).

[0034] It has a power-off direct connection function, that is, in the state of no power supply or the control system not being activated, the relay is default in the closed state, so that the DB9 connector J1F is directly connected to the main link connector J2M to ensure the continuity of the communication path; the relay driving unit adjusts the state of the triode through the control signal sent by the control unit, and then controls the opening and closing of the relay to realize the connection switching between different external devices.

[0035] Embodiment 2 includes: a G6K_2P relay M1, a triode Q1, and a diode D7. The collector of the triode Q1 is grounded, the base is connected to pin 56 of U1, the collector is connected to pin 8 of M1 and the positive pole of the diode, pin 1 of M1 is connected to the negative pole of the diode, pin 6 of M1 is connected to pin 8 of U5, pin 3 of M1 is connected to pin 7 of U5, pin 7 of M1 is connected to pin 14 of U3, and pin 2 of M1 is connected to pin 13 of U3.

[0036] Preferably, the button driving unit includes toggle switches K2-K5 and LED indicators LED3-LED11. The toggle switches are connected to the GPIO input ports of the control unit U1 through their respective independent pins for receiving user input signals. Among them, toggle switch K2 is connected to PE8 of U1; toggle switch K3 is connected to PE10 of U1; toggle switch K4 is connected to PE12 of U1; toggle switch K5 is connected to PE14 of U1; the LED indicators are connected to the GPIO output ports of the control unit U1 through their respective pins, and their on / off states are controlled by the control unit U1. Among them, LED3 is connected to PE9 of U1; LED4 is connected to PE11 of U1; LED5 is connected to PE13 of U1; LED6 is connected to PE15 of U1; LED7 to LED11 are respectively connected to PG1 to PG5 of U1. By detecting the state change of the toggle switch to trigger a specific operation and providing feedback to the user by controlling the on / off of the corresponding LED indicator. That is: toggle switches K2-K5, LED indicators LED3-LED11, STM32F407ZET6 chip. K2 is connected to the PE8 pin of U1, K3 is connected to the PE10 pin of U1, K4 is connected to the PE12 pin of U1, and K5 is connected to the PE14 pin of U1. LED3 is connected to the PE9 pin of U1, LED4 is connected to the PE11 pin of U1, LED5 is connected to the PE13 pin of U1, LED6 is connected to PE15 of U1, LED7 is connected to the PG1 pin of U1, LED8 is connected to the PG2 pin of U1, LED9 is connected to the PG3 pin of U1, LED10 is connected to the PG4 pin of U1, and LED11 is connected to PG5 of U1.

[0037] Preferably, the DIP switch driving unit includes a DIP switch S2. The 1st to 8th pins of the DIP switch S2 are respectively connected to the 10th to 19th pins of the control unit U1 as general-purpose input / output GPIO pins for configuring the working mode; the 9th to 16th pins of the DIP switch S2 are grounded, and the pull-down resistors are used to ensure the stable level in the unactivated state; the DIP switch driving unit provides input signals to the control unit U1 through the state change of the toggle switch for configuring the working mode or parameters of the system. That is: pin 1 of S2 is connected to pin 10 of U1, pin 2 of S2 is connected to pin 11 of U1, pin 3 of S2 is connected to pin 12 of U1, pin 4 of S2 is connected to pin 13 of U1, pin 5 of S2 is connected to pin 14 of U1, pin 6 of S2 is connected to pin 15 of U1, pin 7 of S2 is connected to pin 18 of U1, and pin 8 of S2 is connected to pin 19 of U1. Pins 9-16 of S2 are grounded.

[0038] Preferably, the network interface driver unit includes an RJ45 network port (J6) and an Ethernet physical layer chip (LAN8720A, U6). The RJ45 network port (J6) is connected to the LAN8720A chip (U6) through differential signal lines. Specifically: pin 1 of the RJ45 is connected to pin 21 of the LAN8720A; pin 2 of the RJ45 is connected to pin 20 of the LAN8720A; pin 3 of the RJ45 is connected to pin 23 of the LAN8720A; pin 6 of the RJ45 is connected to pin 22 of the LAN8720A. The LAN8720A chip (U6) is connected to the control unit U1 through a management interface and a data interface. Specifically: pin 12 of the LAN8720A is connected to pin 36 of the STM32F407ZET6; pin 13 of the LAN8720A is connected to pin 27 of the STM32F407ZET6; pins 17 and 18 of the LAN8720A are respectively connected to pins 73 and 74 of the STM32F407ZET6; pin 14 of the LAN8720A is connected to pin 35 of the STM32F407ZET6. The network interface driver unit is used to implement the Ethernet communication function and support the sending and receiving of data through the RJ45 network port. That is: pin 1 of the RJ45 is connected to pin 21 of U6, pin 2 of the RJ45 is connected to pin 20 of U6, pin 3 of the RJ45 is connected to pin 23 of U6, and pin 6 of the RJ45 is connected to pin 22 of U6. Pin 12 of U6 is connected to pin 36 of U1, pin 13 of U6 is connected to pin 27, pins 17 and 18 of U6 are connected to pins 73 and 74 of U1, pin 16 of U6 is connected to pin 70 of U1, pins 8 and 7 of U6 are connected to pins 44 and 45 of U1, pin 11 of U6 is connected to pin 43 of U1, pin 14 of U6 is connected to pin 35 of U1, and pin 15 of U6 is connected to pin 118 of U1.

[0039] Preferably, the power management unit includes an input power interface J3, an input power interface J4, an LM2596S chip U2, and an LM2596S chip U9. The first pin +12V of the input power interface J3 is connected to the fuse F1 through the diode D1 and then accesses the VIN pin of the LM2596S chip U2. The LM2596S chip U2 is configured to reduce the input voltage to a stable 3.3V output. The first pin +12V of the input power interface J4 is directly connected to the VIN pin of the LM2596S chip U9 through the diode D2. The LM2596S chip U9 is configured to reduce the input voltage to a stable 5V output.

[0040] Embodiment 3. The power management unit includes: J3, J4 white connectors, Schottky diodes D1, D2, D5 fuses, LM2596S-3.3V DC-DC power chip U2, LM2596S-5V DC-DC power chip U5, and a 68uH power inductor. J3 is connected to D1, D1 is connected to F1, F1 is connected to pin 1 of U2, pin 2 of U2 is connected to the 68uH power inductor, pin 2 of U2 is connected to D5, pin 3 of U2 is connected to pins 5 and 6 and grounded. Pin 4 is connected to the other end of the inductor.

[0041] The serial port distributor of the present invention is used for detecting multi-RS232 serial link signals, which are divided into two types: the main link and the backup link. When it is the backup link, it is compared with the main link. If it is detected that the backup link has data reception, but the main link has no data reception, and at the same time a time threshold is set. When this state exceeds this time threshold, the system determines that there is a problem with the main link, and thus switches to the backup link with data for transmission, and at the same time pushes an alarm message.

[0042] During the selection process, the automatic selection method is adopted, and at the same time, forced selection can also be used. When forced selection is used, the manual method is adopted, and automatic selection will not be performed after forced selection.

[0043] Its working mode is as follows:

[0044] 1. When the upper end sends data to the device input end, the 4 input ports of the serial port distributor receive the data. At this time, the COM lights of the corresponding ports of the serial port distributor are in the always-on state. If the corresponding ports of the serial port distributor do not receive data, the COM lights are in the always-off state.

[0045] 2. When there is data input, the data is stored in the set buffer area, and the validity of the data is judged. If the data is valid data, the valid data flag bit is set to 1.

[0046] 3. Judge the output mode of the serial port distributor. If there is a port of the serial port distributor in the forced mode, then regardless of whether the data of the port is valid and whether there is data in the port, the device will select the data of this port for transmission. If there are multiple ports in the forced mode, the ports will be selected in the priority order of COM1>COM2>COM3>COM4.

[0047] 4. If no port is in the forced mode, then the device will be in the automatic mode. In this mode, first, the validity of the data is judged. If the data is valid, the data is stored in a specific buffer area.

[0048] 5. In the automatic mode, if there are multiple valid port data, one path of data will be selected for output according to the priority order of the ports: COM1 > COM2 > COM3 > COM4. At this time, the corresponding USER light will be on constantly and the other USER lights will be off constantly.

[0049] 6. If there is no valid data in the current output link, it is necessary to switch to the other links. The switching method is as follows: if there is no valid data in the current valid link and the other links have received N valid data, then switch to the link that reaches N first. N is the maximum number of valid data for switching, and its value can be set through software.

[0050] 7. Output the data of the selected link from the USER_COM port.

[0051] 8. When the data is transmitted reversely, the data is input from the original output port and output from the original input port.

[0052] 9. When transmitting reversely, first judge whether the data is valid data. If the data is valid, the single-chip microcomputer will transmit the data; otherwise, no data transmission will be performed.

[0053] 10. There are 2 output methods to choose from when transmitting reversely. The first one is to output data on all 4 paths, and the second one is to transmit according to the valid path of the input mode.

[0054] 11. The data can also be transmitted through the network. When sending the corresponding command on the software, the device will transmit the data of the currently selected link to the host computer through the network port.

[0055] In particular, during the processing of the serial port distributor, the single-chip microcomputer selects the data with the highest priority among the valid data according to the data received by each serial port in the priority order. When a forced command is triggered, the single-chip microcomputer outputs the data of the forced port. The functions of the single-chip microcomputer can be controlled by sending commands through the network port. The specific method is as follows:

[0056] Signal comparison for selection:

[0057] Put the selected comparison data into a specific buffer and judge whether the data is valid. If the data is valid, set the valid flag to 1 to facilitate the subsequent processing of the data.

[0058] Waiting time for judging validity:

[0059] When the device is powered on, the device will make an initial comparison and judge the validity of the data.

[0060] When a certain link is used as a data input link, if there is no valid data input on the input link after a settable period of time, a re-determination of the input link is performed. The link with data and valid data is used as the input link. When there are multiple input links as valid input links, they are selected according to the fixed priority of the input links.

[0061] Process the valid data:

[0062] When the data of a certain link is valid, the data of this link is stored in its corresponding cache, and all links other than the current link. Due to priority issues, the link with the highest priority is blocked first.

[0063] When the data of a certain link is valid, the data of this link is stored in its corresponding cache.

[0064] If there are multiple paths of valid data, the data input link that arrives first is selected as the valid link output. When multiple links generate valid data simultaneously, the link with the highest priority blocks other links.

[0065] Forced mode:

[0066] Each link corresponds to a forced switch. When the forced switch is turned on, the device will forcibly switch from the current link to the forced link to receive the data of the forced link regardless of whether the data is valid.

[0067] Each link corresponds to a forced switch. When the forced switch is turned on, regardless of whether the transmitted data is valid, the device will forcibly switch from the current link to the forced link and use this forced link for data transmission.

[0068] When multiple links turn on the forced switch simultaneously, the link is selected according to the set priority.

[0069] Automatic mode:

[0070] When all forced switches are in the off state, the device is in automatic mode. In this mode, the device will select the data of the link with the highest priority that inputs valid data according to the set priority order.

[0071] Network control:

[0072] The device can be connected to the network through the network port, and the basic parameters of the device can be set through the network.

[0073] In the description of this specification, the descriptions referring to terms such as "one embodiment", "some embodiments", "schematic embodiments", "preferred embodiments", "specific embodiments", or "preferred embodiments" etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0074] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; thus, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.

Claims

1. A serial port distributor, characterized in that: It includes a serial port receiving unit, a serial port sending unit, a network interface driving unit, a DIP switch driving unit, a key driving unit, a control unit U1, a power management unit, and a relay driving unit; The control unit U1 is respectively connected to the serial port receiving unit, the serial port sending unit, the network interface driving unit, the DIP switch driving unit, the key driving unit, the power management unit, and the relay driving unit; The relay driving unit is connected to the serial port sending unit.

2. The serial port distributor according to claim 1, characterized in that: The control unit U1 includes the chip STM32F407ZET6; the I2C storage device is connected to the control unit U1 through the I2C1_SCL and I2C1_SDA pins.

3. The serial port distributor according to claim 2, characterized in that: The serial port receiving unit includes a DB9 connector J2M-J5M, and level conversion chips U4 and U5, and both the level conversion chips U4 and U5 use the chip MAX3232; the 2nd pin of J2M is connected to the 8th pin of the level conversion chip U5, the 3rd pin of J2M is connected to the 7th pin of the level conversion chip U5, and the 5th pin of J2M is grounded; the 2nd pin of J3M is connected to the 13th pin of the level conversion chip U5, the 3rd pin of J3M is connected to the 14th pin of the level conversion chip U5, and the 5th pin of J3M is grounded; the 2nd pin of J4M is connected to the 8th pin of the level conversion chip U4, the 3rd pin of J4M is connected to the 7th pin of the level conversion chip U4, and the 5th pin of J4M is grounded; the 2nd pin of J5M is connected to the 13th pin of the level conversion chip U4, the 3rd pin of J5M is connected to the 14th pin of the level conversion chip U4, and the 5th pin of J5M is grounded; the 9th-12th pins of the level conversion chip U4 are respectively connected to the 113th pin, 112th pin, 129th pin, and 124th pin of the control unit U1; the 9th-12th pins of the level conversion chip U5 are respectively connected to the 102nd pin, 101st pin, 113th pin, and 116th pin of the control unit U1.

4. The serial port distributor according to claim 2, characterized in that: The serial port sending unit includes a DB9 connector J1F and a level conversion chip U3, and the level conversion chip U3 uses the chip MAX3232; the DB9 connector J1F is connected to the level conversion chip U3 through a signal line for realizing the conversion between RS232 level and TTL level; among them, the 2nd pin of the DB9 connector J1F is connected to the 14th pin of the level conversion chip U3; the 3rd pin of the DB9 connector J1F is connected to the 13th pin of the level conversion chip U3; the level conversion chip U3 is connected to the control unit U1 through a signal line for realizing the reception and transmission of serial communication data. Among them, the 11th pin of the level conversion chip U3 is connected to the 77th pin of the control unit U1 for receiving external serial port data; the 12th pin of the level conversion chip U3 is connected to the 78th pin of the control unit U1 for sending data to an external serial port device.

5. The serial port distributor according to claim 4, characterized in that: The relay driving unit includes a relay M1 and a triode Q1; the base of the triode Q1 is connected to the 56th pin of the control unit U1 for receiving a control signal to drive the relay; the 7th and 2nd pins of the relay contact are respectively connected to the 14th and 13th pins of the level conversion chip U3; the 6th and 3rd pins of the relay contact are respectively connected to the 8th and 7th pins of the level conversion chip U5.

6. The serial port distributor according to claim 1, characterized in that: The button driving unit includes toggle switches K2 - K5 and LED indicators LED3 - LED11. The toggle switches are connected to the GPIO input ports of the control unit U1 through their respective independent pins for receiving user input signals. Among them, toggle switch K2 is connected to PE8 of U1; toggle switch K3 is connected to PE10 of U1; toggle switch K4 is connected to PE12 of U1; toggle switch K5 is connected to PE14 of U1. The LED indicators are connected to the GPIO output ports of the control unit U1 through their respective pins, and their on / off states are controlled by the control unit U1. Among them, LED3 is connected to PE9 of U1; LED4 is connected to PE11 of U1; LED5 is connected to PE13 of U1; LED6 is connected to PE15 of U1; LED7 to LED11 are respectively connected to PG1 to PG5 of U1.

7. A serial port distributor according to claim 1, characterized in that: The DIP switch driving unit includes a DIP switch S2. Pins 1 to 8 of the DIP switch S2 are respectively connected to pins 10 to 19 of the control unit U1 as general input / output GPIO pins for configuring the working mode. Pins 9 to 16 of the DIP switch S2 are grounded.

8. A serial port distributor according to claim 2, wherein: The network interface driving unit includes a network interface RJ45 and a chip LAN8720A. The network interface RJ45 is connected to the LAN8720A chip through differential signal lines. Among them: pin 1 of RJ45 is connected to pin 21 of LAN8720A; pin 2 of RJ45 is connected to pin 20 of LAN8720A; pin 3 of RJ45 is connected to pin 23 of LAN8720A; pin 6 of RJ45 is connected to pin 22 of LAN8720A; LAN8720A is connected to the control unit U1 through a management interface and a data interface. Among them: pin 12 of LAN8720A is connected to pin 36 of STM32F407ZET6; pin 13 of LAN8720A is connected to pin 27 of STM32F407ZET6; pins 17 and 18 of LAN8720A are respectively connected to pins 73 and 74 of STM32F407ZET6; pin 14 of LAN8720A is connected to pin 35 of STM32F407ZET6.

9. The serial port distributor according to claim 1, characterized in that: The power management unit includes input power interfaces J3, J4, LM2596S chips U2 and U9. The first pin +12V of the input power interface J3 is connected to the fuse F1 through the diode D1 and then accesses the VIN pin of the LM2596S chip U2. The LM2596S chip U2 is configured to reduce the input voltage to a stable 3.3V output. The first pin +12V of the input power interface J4 is directly connected to the VIN pin of the LM2596S chip U9. The LM2596S chip U9 is configured to reduce the input voltage to a stable 5V output.