CN112988642A - Reverse connection preventing method for serial port signals and switch switching circuit - Google Patents

Reverse connection preventing method for serial port signals and switch switching circuit Download PDF

Info

Publication number
CN112988642A
CN112988642A CN201911292680.8A CN201911292680A CN112988642A CN 112988642 A CN112988642 A CN 112988642A CN 201911292680 A CN201911292680 A CN 201911292680A CN 112988642 A CN112988642 A CN 112988642A
Authority
CN
China
Prior art keywords
serial port
switch
signal
switching circuit
port device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911292680.8A
Other languages
Chinese (zh)
Inventor
张争龙
冯声威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201911292680.8A priority Critical patent/CN112988642A/en
Publication of CN112988642A publication Critical patent/CN112988642A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4004Coupling between buses
    • G06F13/4022Coupling between buses using switching circuits, e.g. switching matrix, connection or expansion network

Abstract

The application discloses a serial port signal reverse connection prevention method and a switch switching circuit, wherein the switch switching circuit is connected with a first serial port device through a first serial port and is connected with a second serial port device through a second serial port; the reverse connection preventing method comprises the following steps: identifying a sending end and a receiving end of the first serial port device; identifying a sending end and a receiving end of the second serial port device; and controlling a switch array in the switch switching circuit to switch the switch state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device. This application utilizes the switch switching circuit who links between two serial devices, according to the identification result to serial devices's sending end, receiving terminal, and the internal connection state of control switch switching circuit need not to carry out the change of the line to serial devices's self interface and can realize the anti-transposition of serial signals, has reduced the human cost and has improved efficiency.

Description

Reverse connection preventing method for serial port signals and switch switching circuit
Technical Field
The application relates to the technical field of circuit design, in particular to an anti-reverse connection method for serial port signals and a switch switching circuit.
Background
Serial ports are widely used in various electronic devices because of their low price and convenience in use, and are commonly used for device communication, device debugging, fault device problem location, and the like. Two data lines for transmitting data are generally arranged in the serial port, and both data lines are in one-way transmission. For the device itself, one of the two data lines of its serial port is dedicated to sending data, while the other data line is dedicated to receiving data. Therefore, when two serial devices are connected, under normal conditions, the transmitting end of one serial device should be connected with the receiving end of the other serial device, but cannot be connected with the transmitting end of the other serial device (at this time, the serial device is in a reverse connection state). Once the condition of reverse connection occurs, serial communication between the two serial devices cannot be normally performed. To this end, the serial line order of the connector usually needs to be changed, or the internal circuit of the serial device needs to be modified to change the serial line order on the PCB board. The line sequence changing work is time-consuming and labor-consuming, needs to be repeatedly checked, and has the risk of misoperation. In view of the above, it is an important need for those skilled in the art to provide a solution to the above technical problems.
Disclosure of Invention
The application aims to provide an anti-reverse connection method and a switch switching circuit for serial port signals, so that anti-reverse connection processing for the serial port signals can be quickly and conveniently and automatically realized, normal serial port communication is guaranteed, and meanwhile, manpower maintenance cost is effectively reduced and efficiency is improved.
In order to solve the technical problem, in a first aspect, the application discloses an anti-reverse connection method for serial port signals, which is applied to a switch switching circuit, wherein the switch switching circuit is connected with a first serial port device through a first serial port and is connected with a second serial port device through a second serial port; the reverse connection preventing method comprises the following steps:
identifying a sending end and a receiving end of the first serial port device;
identifying a sending end and a receiving end of the second serial port device;
and controlling a switch array in the switch switching circuit to switch the on-off state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
Optionally, the process of identifying the transmitting end and the receiving end of the target serial device includes:
carrying out data transmission signal characteristic detection on two signal ends in a target serial port connected with the target serial port equipment;
identifying a signal end which accords with the data transmission signal characteristic as a transmitting end of the target serial port equipment;
identifying the other signal end in the target serial port as a receiving end of the target serial port device;
when the target serial port device is the first serial port device, the target serial port is the first serial port; and when the target serial port equipment is the second serial port equipment, the target serial port is the second serial port.
Optionally, the performing data transmission signal characteristic detection on two signal terminals in a target serial port connected to the target serial port device includes:
and detecting the falling edges of two signal ends in the target serial port connected with the target serial port equipment.
Optionally, the controlling, based on the identification result, the switch array in the switch switching circuit to switch the switch state, so that the sending end of the first serial port device is connected to the receiving end of the second serial port device, and the receiving end of the first serial port device is connected to the sending end of the second serial port device, includes:
when the identification of the sending end and the receiving end of the first serial port device fails and/or the identification of the sending end and the receiving end of the second serial port device fails, taking two signal ends in the first serial port device as a first signal end and a second signal end respectively, and taking two signal ends in the second serial port device as a third signal end and a fourth signal end respectively;
switching the switch array to a first switch state to connect the first signal terminal with the third signal terminal and connect the second signal terminal with the fourth signal terminal;
judging whether the first serial port equipment and the second serial port equipment are in normal communication or not;
if so, judging that the serial port is correctly wired;
if not, the switch array is switched to a second switch state, so that the first signal end is connected with the fourth signal end, and the second signal end is connected with the third signal end.
Optionally, after the controlling the switch array in the switch switching circuit to switch the switch state based on the identification result, the method further includes:
and generating and outputting a connection success indication signal to an indication module in the switch switching circuit.
In a second aspect, the application also discloses a switch switching circuit, which is connected with the first serial port device through the first serial port and connected with the second serial port device through the second serial port; the switch switching circuit comprises a control module and a switch array;
the control module is used for: identifying a sending end and a receiving end of the first serial port device; identifying a sending end and a receiving end of the second serial port device; and controlling a switch array in the switch switching circuit to switch the on-off state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
Optionally, the control module is specifically configured to, when identifying the sending end and the receiving end of the target serial device:
carrying out data transmission signal characteristic detection on two signal ends in a target serial port connected with the target serial port equipment; identifying a signal end which accords with the data transmission signal characteristic as a transmitting end of the target serial port equipment; identifying the other signal end in the target serial port as a receiving end of the target serial port device;
when the target serial port device is the first serial port device, the target serial port is the first serial port; and when the target serial port equipment is the second serial port equipment, the target serial port is the second serial port.
Optionally, the control module is specifically configured to:
and detecting the falling edges of two signal ends in the target serial port connected with the target serial port equipment.
Optionally, when the identification of the sending end and the receiving end of the first serial device fails, and/or the identification of the sending end and the receiving end of the second serial device fails, the control module is specifically configured to:
two signal ends in the first serial port are respectively used as a first signal end and a second signal end; two signal ends in the second serial port are respectively used as a third signal end and a fourth signal end; switching the switch array to a first switch state to connect the first signal terminal with the third signal terminal and connect the second signal terminal with the fourth signal terminal; judging whether the first serial port equipment and the second serial port equipment are in normal communication or not; if so, judging that the serial port is correctly wired; if not, the switch array is switched to a second switch state, so that the first signal end is connected with the fourth signal end, and the second signal end is connected with the third signal end.
Optionally, the method further comprises:
and the indication module is connected with the control module and used for receiving a connection success indication signal sent by the control module after the control module controls the switch array in the switch switching circuit to switch the switch state based on the identification result.
Optionally, the switch array comprises a first switch, a second switch, a third switch and a fourth switch;
two ends of the first switch are respectively connected with a first signal end of the first serial port and a third signal end of the second serial port;
two ends of the second switch are respectively connected with the first signal end of the first serial port and the fourth signal end of the second serial port;
two ends of the third switch are respectively connected with the second signal end of the first serial port and the third signal end of the second serial port;
and two ends of the fourth switch are respectively connected with the second signal end of the first serial port and the fourth signal end of the second serial port.
Optionally, the first to fourth switches are embodied as optocouplers or relays or multiplexers.
The method for preventing the reverse connection of the serial port signals is applied to a switch switching circuit, wherein the switch switching circuit is connected with first serial port equipment through a first serial port and is connected with second serial port equipment through a second serial port; the reverse connection preventing method comprises the following steps: identifying a sending end and a receiving end of the first serial port device; identifying a sending end and a receiving end of the second serial port device; and controlling a switch array in the switch switching circuit to switch the on-off state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
Therefore, the switch switching circuit connected between the two serial devices is utilized, after the sending end and the receiving end of the two serial devices are respectively identified, the two serial devices can be correctly connected in a serial port line according to the identification result by controlling the internal connection state of the switch switching circuit, the reverse connection prevention processing of serial signals is conveniently and efficiently realized, and the normal serial communication is ensured. Based on the switch switching circuit connected between the serial devices, the serial device has the functions of serial line sequence selection and correction, the interface of the serial device is not required to be changed, manual operation is avoided, the labor cost and the misoperation rate are effectively reduced, and the efficiency is greatly improved. The switch switching circuit provided by the application also has the beneficial effects.
Drawings
In order to more clearly illustrate the technical solutions in the background art and the embodiments of the present application, the drawings that are needed to be used in the description of the background art and the embodiments of the present application will be briefly described below. Of course, the following description of the drawings related to the embodiments of the present application is only a part of the embodiments of the present application, and it will be obvious to those skilled in the art that other drawings can be obtained from the provided drawings without any creative effort, and the obtained other drawings also belong to the protection scope of the present application.
Fig. 1 is a schematic diagram of a serial port signal reverse connection disclosed in an embodiment of the present application;
fig. 2 is a flowchart of a serial port signal reverse connection prevention method disclosed in the embodiment of the present application;
fig. 3 is a flowchart of another method for preventing reverse connection of serial signals according to the embodiment of the present application;
fig. 4 is a flowchart of a method for controlling a switch array to switch between switch states according to an embodiment of the present disclosure;
fig. 5 is a block diagram of a switch switching circuit according to an embodiment of the present disclosure;
fig. 6 is a circuit structure diagram of a switch switching circuit disclosed in the embodiment of the present application;
fig. 7 is a schematic coupling diagram of a control module and an optocoupler switch according to an embodiment of the disclosure;
FIG. 8 is a schematic diagram illustrating a coupling between a control module and a relay switch according to an embodiment of the disclosure;
fig. 9 is a diagram of a specific application scenario of a switch switching circuit disclosed in an embodiment of the present application.
Detailed Description
The core of the application lies in providing a serial port signal reverse connection prevention method and a switch switching circuit, so that reverse connection prevention processing of the serial port signal can be rapidly and conveniently and automatically realized, normal serial port communication is guaranteed, meanwhile, manpower maintenance cost is effectively reduced, and efficiency is improved.
In order to more clearly and completely describe the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Currently, serial ports are widely used in various electronic devices due to their low price and convenient use, and are often used for device communication, device debugging, fault device problem location, and the like. Two data lines for transmitting data are generally arranged in the serial port, and both data lines are in one-way transmission. For the device itself, one of the two data lines of its serial port is dedicated to sending data, while the other data line is dedicated to receiving data.
Therefore, when two serial devices are connected, under normal conditions, the transmitting end of one serial device should be connected with the receiving end of the other serial device, but cannot be connected with the transmitting end of the other serial device (at this time, the serial device is in a reverse connection state). Once the condition of reverse connection occurs, for example, in fig. 1, the transmitting end Tx (1) of the left serial device is connected to the transmitting end Tx (2) of the right serial device, and the receiving end Rx (1) of the left serial device is connected to the receiving end Rx (2) of the right serial device, so that serial communication cannot be performed normally between the two serial devices at this time.
To this end, the serial line order of the connector usually needs to be changed, or the internal circuit of the serial device needs to be modified to change the serial line order on the PCB board. The line sequence changing work is time-consuming and labor-consuming, needs to be repeatedly checked, and has the risk of misoperation. In view of this, the present application provides an anti-reverse connection method for serial port signals and a switch switching circuit, which can effectively solve the above problems.
Referring to fig. 2, an embodiment of the application discloses an anti-reverse connection method for serial port signals, which is applied to a switch switching circuit, wherein the switch switching circuit is connected with a first serial port device through a first serial port and is connected with a second serial port device through a second serial port; the reverse connection preventing method comprises the following steps:
s101: and identifying the sending end and the receiving end of the first serial port device.
S102: and identifying the sending end and the receiving end of the second serial port device.
S103: and controlling a switch array in the switch switching circuit to switch the switch state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
It should be noted that the method for preventing reverse connection of serial port signals provided in the embodiment of the present application specifically uses a switch switching circuit to solve the problem of correct connection of serial port signals. Specifically, the switch switching circuit is disposed between two serial devices that need to perform serial communication, the two serial devices are not called a first serial device and a second serial device, a connection interface between the switch switching circuit and the first serial device is called a first serial port, and a connection interface between the switch switching circuit and the second serial device is called a second serial port.
As the name implies, a switching circuit may be used for switching the switching state, which comprises an array of switches. Through the different on-off states of the control switch array, the line connection state of the switch switching circuit between the first serial port and the second serial port can be changed conveniently and efficiently, and then the wiring mode of the first serial port device and the second serial port device is changed.
Therefore, even if the serial port signals of the first serial port device and the second serial port device are reversely connected, the circuit connection state inside the switch switching circuit can be changed by changing the switch state of the switch array, and the purpose of correctly connecting the first serial port device and the second serial port device is achieved.
It is easy to understand that, besides the switch array, the switch switching circuit should also include a control module for controlling the on-off state of each switch in the switch array, and the control module can be implemented based on various MCU, FPGA, DSP, and other devices. And the control module has the identification function of the sending end and the receiving end of the serial port, so that the switch switching circuit can identify the sending end and the receiving end of the first serial port device connected to the first serial port and identify the sending end and the receiving end of the second serial port device connected to the second serial port.
It can be easily understood that, when these four signal terminals are all successfully identified, the switch between the first serial port device transmitting terminal and the second serial port device receiving terminal can be directly controlled to be closed respectively, and the switch between the first serial port device receiving terminal and the second serial port device transmitting terminal can be controlled to be closed, and other switches are opened, so that the transmitting terminal of the first serial port device is connected with the receiving terminal of the second serial port device, and the receiving terminal of the first serial port device is correspondingly connected with the transmitting terminal of the second serial port device.
It should be further noted that, the sequence of step S101 and step S102 is not limited in the present application, and those skilled in the art may also exchange the execution sequence of step S101 and step S102.
The method for preventing the reverse connection of the serial port signals is applied to a switch switching circuit, wherein the switch switching circuit is connected with first serial port equipment through a first serial port and is connected with second serial port equipment through a second serial port; the reverse connection preventing method comprises the following steps: identifying a sending end and a receiving end of the first serial port device; identifying a sending end and a receiving end of the second serial port device; and controlling a switch array in the switch switching circuit to switch the switch state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
Therefore, the switch switching circuit connected between the two serial devices is utilized, after the sending end and the receiving end of the two serial devices are respectively identified, the two serial devices can be correctly connected in a serial port line according to the identification result by controlling the internal connection state of the switch switching circuit, the reverse connection prevention processing of serial signals is conveniently and efficiently realized, and the normal serial communication is ensured. Based on the switch switching circuit connected between the serial devices, the serial device has the functions of serial line sequence selection and correction, the interface of the serial device is not required to be changed, manual operation is avoided, the labor cost and the misoperation rate are effectively reduced, and the efficiency is greatly improved.
As a specific embodiment, in the method for preventing reverse connection of a serial port signal provided in the embodiment of the present application, on the basis of the foregoing content, a process of identifying a transmitting end and a receiving end of a target serial port device by a switch switching circuit may specifically include:
carrying out data transmission signal characteristic detection on two signal ends in a target serial port connected with target serial port equipment; identifying a signal end which accords with the characteristics of the data transmission signal as a transmitting end of the target serial port equipment; and identifying the other signal end in the target serial port as the receiving end of the target serial port device.
When the target serial port device is a first serial port device, the target serial port is a first serial port; and when the target serial port equipment is second serial port equipment, the target serial port is the second serial port.
Specifically, it is easily understood that, in the serial communication protocol, in order to facilitate the device to clarify the arrival of data sent by the opposite device, a data sending signal feature is generally set, and for the device receiving data, when the data sending signal feature is recognized, it can be determined that data is about to be transmitted.
Therefore, referring to fig. 3, fig. 3 is a method for preventing a serial port signal from being reversely connected, which is disclosed in the embodiment of the present application, and mainly includes:
s201: and carrying out data transmission signal characteristic detection on two signal ends in the first serial port.
For one embodiment, the data transmit signal characteristic may be a falling edge. Therefore, in step S201, falling edge detection may be specifically performed on two signal terminals in the first serial port connected to the first serial port device.
S202: identifying a signal end which accords with the characteristics of a data transmission signal as a transmitting end of first serial port equipment; and identifying the other signal end in the first serial port as a receiving end of the first serial port device.
Specifically, two signal ends in the first serial port are a sending end and a receiving end of the first serial port device, respectively, where the signal end that detects the falling edge is the sending end of the first serial port device, and the signal end that does not detect the falling edge is the receiving end of the first serial port device.
S203: and carrying out data transmission signal characteristic detection on two signal ends in the second serial port.
Similarly, in this step 203, falling edge detection may be specifically performed on two signal terminals in the second serial port connected to the second serial port device.
S204: identifying the signal end which accords with the data transmission signal characteristic as a transmitting end of the second serial port device; and identifying the other signal end in the second serial port as a receiving end of the second serial port device.
Similarly, two signal ends in the second serial port are respectively a sending end and a receiving end of the second serial port device, wherein the signal end which detects the falling edge is the sending end of the second serial port device, and the signal end which does not detect the falling edge is the receiving end of the second serial port device.
S205: and controlling a switch array in the switch switching circuit to switch the switch state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
S206: and generating and outputting a connection success indicating signal to an indicating module in the switch switching circuit.
Specifically, in this embodiment, the switch switching circuit may further include an indication module. After the switch state is successfully switched to achieve correct wiring in step S205, the present embodiment may further send a connection success indication signal to the indication module, so that the indication module indicates the connection success to the user.
As a specific embodiment, the indication module may be an LED lamp indication module. Of course, besides the light display indication module, the indication module may also be a sound indication module, and here, the indication module is not particularly limited.
Referring to fig. 4, fig. 4 is a flowchart of a method for controlling a switch array to switch a switch state, which is disclosed in the embodiment of the present application, and mainly includes:
s301: when the identification of the sending end and the receiving end of the first serial port device fails and/or the identification of the sending end and the receiving end of the second serial port device fails, two signal ends in the first serial port are respectively used as a first signal end and a second signal end, and two signal ends in the second serial port are respectively used as a third signal end and a fourth signal end.
Specifically, when the switch array is controlled to switch the switch state based on the identification result in step 103, the identification result may include a plurality of types. One of them, as described above, if the four signal terminals, that is, the transmitting terminal and the receiving terminal of the first serial device and the transmitting terminal and the receiving terminal of the second serial device, are successfully identified, the first serial device and the second serial device can be correctly connected by directly controlling the switch state of the switch array.
In consideration of the fact that in practical applications, some serial devices may only be used for receiving data without sending data, and factors such as misjudgment and the like are considered, in addition to the above-mentioned identification result, situations may also exist in which all four signal terminals are not successfully identified, including that identification of a sending terminal and a receiving terminal of a first serial device fails, and/or identification of a sending terminal and a receiving terminal of a second serial device fails. For the identification result, the switch switching circuit can realize the correct wiring of the two serial devices in a verification mode.
Specifically, two signal terminals in the first serial port may be respectively determined as a first signal terminal and a second signal terminal, and two signal terminals in the second serial port may be respectively determined as a third signal terminal and a fourth signal terminal. Under the condition of not determining which signal end is the sending end, a connection mode can be randomly selected first. Because four signal terminals have two different connection modes in total, whether the first connection mode is correct or not can be verified, and if the first connection mode is incorrect, the first connection mode is replaced by the second connection mode.
S302: and switching the switch array into a first switch state so as to connect the first signal end with the third signal end and connect the second signal end with the fourth signal end.
S303: judging whether the first serial port device and the second serial port device are in normal communication or not; if yes, entering S304; if not, the process proceeds to S305.
S304: judging that the serial port is correctly wired; the process proceeds to S306.
S305: switching the switch array to a second switch state to enable the first signal end to be connected with the fourth signal end and the second signal end to be connected with the third signal end; the process proceeds to S306.
It should be noted that, in this embodiment, a default switching state that the first signal terminal is connected to the third signal terminal and the second signal terminal is connected to the fourth signal terminal is specifically adopted, and a person skilled in the art may also default to adopt another switching state that the first signal terminal is connected to the fourth signal terminal and the second signal terminal is connected to the third signal terminal.
S306: and generating and outputting a connection success indicating signal to an indicating module in the switch switching circuit.
Referring to fig. 5, an embodiment of the present application discloses a switch switching circuit, which is connected to a first serial port device through a first serial port and connected to a second serial port device through a second serial port; the switch switching circuit comprises a control module 401 and a switch array 402;
the control module 401 is configured to: identifying a sending end and a receiving end of the first serial port device; identifying a sending end and a receiving end of the second serial port device; and controlling a switch array 402 in the switch switching circuit to switch the switch state based on the identification result so as to connect the transmitting end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the transmitting end of the second serial port device.
It should be noted that the control module 401 and the switch array 402 of the switch switching circuit are both specifically connected between the first serial port device and the second serial port device, and perform the line sequence selection and replacement function through signal terminal identification and switch state switching. Specifically, each signal end of the first serial port is correspondingly connected with one end of each switch in the switch array 402, and is simultaneously connected with the input end of the control module 401; each signal end of the second serial port is correspondingly connected with the other end of each switch in the switch array 402, and is simultaneously connected with the input end of the control module 401. The control module 401 is coupled to each switch in the switch array 402, and can control the on/off state of each switch to change the switch state of the switch array 402.
For the specific content of the switch switching circuit, reference may be made to the foregoing detailed description of the method for preventing the serial port signal from being connected reversely, and details thereof are not repeated here.
Therefore, the switch switching circuit disclosed in the embodiment of the application utilizes the switch switching circuit connected between the two serial devices, after the sending end and the receiving end of the two serial devices are respectively identified, the two serial devices can be correctly connected with the serial port according to the identification result by controlling the internal connection state of the switch switching circuit, so that the reverse connection prevention processing of serial signals is conveniently and efficiently realized, and the normal serial communication is ensured. Based on the switch switching circuit connected between the serial devices, the serial device has the functions of serial line sequence selection and correction, the interface of the serial device is not required to be changed, manual operation is avoided, the labor cost and the misoperation rate are effectively reduced, and the efficiency is greatly improved.
In a specific implementation manner, in the switch switching circuit disclosed in this embodiment of the present application, on the basis of the foregoing, the control module 401 is specifically configured to, when identifying the transmitting end and the receiving end of the target serial device:
carrying out data transmission signal characteristic detection on two signal ends in a target serial port connected with target serial port equipment; identifying a signal end which accords with the characteristics of the data transmission signal as a transmitting end of the target serial port equipment; identifying the other signal end in the target serial port as a receiving end of the target serial port device;
when the target serial port device is a first serial port device, the target serial port is a first serial port; and when the target serial port equipment is second serial port equipment, the target serial port is the second serial port.
In a specific implementation manner, in the switch switching circuit disclosed in the embodiment of the present application, on the basis of the foregoing content, the control module 401 is specifically configured to:
and detecting the falling edges of two signal ends in the target serial port connected with the target serial port equipment.
In a specific implementation manner, on the basis of the above contents, when the identification of the transmitting end and the receiving end of the first serial device fails, and/or the identification of the transmitting end and the receiving end of the second serial device fails, the control module 401 is specifically configured to:
two signal ends in the first serial port are respectively used as a first signal end and a second signal end; two signal ends in the second serial port are respectively used as a third signal end and a fourth signal end; switching the switch array 402 to a first switch state to connect the first signal terminal with the third signal terminal and connect the second signal terminal with the fourth signal terminal; judging whether the first serial port device and the second serial port device are in normal communication or not; if so, judging that the serial port is correctly wired; if not, the switch array 402 is switched to a second switch state, so that the first signal terminal is connected to the fourth signal terminal, and the second signal terminal is connected to the third signal terminal.
In a specific implementation manner, the switch switching circuit disclosed in the embodiment of the present application further includes, on the basis of the foregoing content:
and the indication module is connected with the control module 401 and is used for receiving a connection success indication signal sent by the control module 401 after the control module 401 controls the switch array 402 in the switch switching circuit to switch the switch state based on the identification result.
Referring to fig. 6, fig. 6 is a circuit structure diagram of a switch switching circuit disclosed in the embodiment of the present application.
As shown in fig. 6, in the switch switching circuit disclosed in the embodiment of the present application, based on the above, the switch array 402 includes a first switch, a second switch, a third switch, and a fourth switch;
two ends of the first switch S1 are respectively connected with a first signal end of the first serial port and a third signal end of the second serial port;
two ends of the second switch S2 are connected to the first signal end of the first serial port and the fourth signal end of the second serial port, respectively;
two ends of the third switch S3 are respectively connected with the second signal end of the first serial port and the third signal end of the second serial port;
two ends of the fourth switch S4 are connected to the second signal terminal of the first serial port and the fourth signal terminal of the second serial port, respectively.
Specifically, since there are two signal terminals in each serial port, as described above, there are two connection modes in total between the two serial ports, and the two connection modes can be implemented based on four switches.
In a specific implementation manner, in the switch switching circuit disclosed in the embodiment of the present application, based on the above, the first to fourth switches may be specifically optical couplers, or relays, or multiplexers. The multiplexer may be MAX 14662.
Specifically, referring to fig. 7, fig. 7 is a schematic diagram illustrating a coupling between a control module 401 and an optocoupler switch according to an embodiment of the disclosure. Specifically, the control module 401 may be specifically an MCU, and the light emitting diode D in the optocoupler is connected in series between the power supply VDD and an MCU control pin, and when the MCU control pin outputs a low level, the light emitting diode D emits light, so that the transistor T in the optocoupler is turned on.
Specifically, referring to fig. 8, fig. 8 is a schematic diagram illustrating a coupling between a control module 401 and a relay switch according to an embodiment of the present disclosure. Specifically, the control module 401 may be an MCU, one end of a control coil L of the relay is connected to a power supply VDD through a resistor R, and the other end is grounded after being connected in series with a PMOS transistor Q; the control end of the PMOS tube Q is connected with an MCU control pin, when the MCU control pin outputs a low level, the PMOS tube Q is conducted, and a control coil L of the relay is electrified to generate attraction force, so that an armature of the relay is attracted, and a relay switch is closed.
It should be noted that the technical solution provided by the present application can be applied to any two serial devices that need to perform serial communication, such as a face feature acquisition device and a face recognition device, and further, such as a debugged device and a debugging terminal.
It should be noted that the serial port includes multiple types, and corresponds to different level standards, such as TTL/CMOS standard and RS232 standard, the former adopts 3.3V or 5V level, which is commonly used in terminal devices such as mobile phones and tablets, and the latter adopts 12V level, which is commonly used in devices such as PCs.
Therefore, in a specific implementation manner, on the basis of the above contents, when the serial port types of the first serial port device and the second serial port device are different, the second serial port of the switch switching circuit may be specifically connected to the second serial port device through the level shifter circuit.
For example, fig. 9 may be specifically referred to, and fig. 9 is a diagram illustrating a specific application scenario of a switch switching circuit disclosed in an embodiment of the present application.
In fig. 9, the first serial port device specifically uses TTL/CMOS standard, and the transmitting end and the receiving end thereof may be respectively denoted as tx (d) and rx (d), and the second serial port device specifically uses RS232 standard, and the transmitting end and the receiving end thereof may be respectively denoted as tx (pc) and rx (pc). In practical application, the RS232 serial port of the second serial device may be specifically converted into a TTL/CMOS serial port through a level conversion circuit, so as to be connected to the second serial port of the switch switching circuit. Wherein Tx (PC) is converted to be Rx, so as to connect with Rx (D); rx (PC) may be denoted as Tx after conversion for connection with Tx (D).
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the equipment disclosed by the embodiment, the description is relatively simple because the equipment corresponds to the method disclosed by the embodiment, and the relevant parts can be referred to the method part for description.
It is further noted that, throughout this document, relational terms such as "first" and "second" are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The technical solutions provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall into the protection scope of the present application.

Claims (10)

1. The method is characterized in that the method is applied to a switch switching circuit, and the switch switching circuit is connected with a first serial port device through a first serial port and is connected with a second serial port device through a second serial port; the reverse connection preventing method comprises the following steps:
identifying a sending end and a receiving end of the first serial port device;
identifying a sending end and a receiving end of the second serial port device;
and controlling a switch array in the switch switching circuit to switch the on-off state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
2. The method for preventing reverse connection of serial port signals according to claim 1, wherein the process of identifying the transmitting end and the receiving end of the target serial port device comprises the following steps:
carrying out data transmission signal characteristic detection on two signal ends in a target serial port connected with the target serial port equipment;
identifying a signal end which accords with the data transmission signal characteristic as a transmitting end of the target serial port equipment;
identifying the other signal end in the target serial port as a receiving end of the target serial port device;
when the target serial port device is the first serial port device, the target serial port is the first serial port; and when the target serial port equipment is the second serial port equipment, the target serial port is the second serial port.
3. The method for preventing reverse connection of serial port signals according to claim 2, wherein the detecting of the characteristics of data transmission signals of two signal ends in a target serial port connected with the target serial port device comprises:
and detecting the falling edges of two signal ends in the target serial port connected with the target serial port equipment.
4. The method for preventing reverse connection of serial port signals according to claim 1, wherein the controlling a switch array in the switch switching circuit to switch the switch state based on the identification result so that a transmitting end of the first serial port device is connected to a receiving end of the second serial port device, and the receiving end of the first serial port device is connected to the transmitting end of the second serial port device comprises:
when the identification of the sending end and the receiving end of the first serial port device fails and/or the identification of the sending end and the receiving end of the second serial port device fails, taking two signal ends in the first serial port device as a first signal end and a second signal end respectively, and taking two signal ends in the second serial port device as a third signal end and a fourth signal end respectively;
switching the switch array to a first switch state to connect the first signal terminal with the third signal terminal and connect the second signal terminal with the fourth signal terminal;
judging whether the first serial port equipment and the second serial port equipment are in normal communication or not;
if so, judging that the serial port is correctly wired;
if not, the switch array is switched to a second switch state, so that the first signal end is connected with the fourth signal end, and the second signal end is connected with the third signal end.
5. The method for preventing reverse connection of serial port signals according to any one of claims 1 to 4, wherein after the switch state switching is performed by controlling a switch array in the switch switching circuit based on the identification result, the method further comprises:
and generating and outputting a connection success indication signal to an indication module in the switch switching circuit.
6. A switch switching circuit is characterized in that the switch switching circuit is connected with a first serial port device through a first serial port and is connected with a second serial port device through a second serial port; the switch switching circuit comprises a control module and a switch array;
the control module is used for: identifying a sending end and a receiving end of the first serial port device; identifying a sending end and a receiving end of the second serial port device; and controlling a switch array in the switch switching circuit to switch the on-off state based on the identification result so as to connect the sending end of the first serial port device with the receiving end of the second serial port device and connect the receiving end of the first serial port device with the sending end of the second serial port device.
7. The switch switching circuit according to claim 6, wherein the control module is specifically configured to, when identifying the transmitting end and the receiving end of the target serial device:
carrying out data transmission signal characteristic detection on two signal ends in a target serial port connected with the target serial port equipment; identifying a signal end which accords with the data transmission signal characteristic as a transmitting end of the target serial port equipment; identifying the other signal end in the target serial port as a receiving end of the target serial port device;
when the target serial port device is the first serial port device, the target serial port is the first serial port; when the target serial port device is the second serial port device, the target serial port is the second serial port;
the control module is specifically further configured to: and detecting the falling edges of two signal ends in the target serial port connected with the target serial port equipment.
8. The switch switching circuit according to claim 6, wherein when the identification of the transmitting end and the receiving end of the first serial device fails, and/or the identification of the transmitting end and the receiving end of the second serial device fails, the control module is specifically configured to:
two signal ends in the first serial port are respectively used as a first signal end and a second signal end; two signal ends in the second serial port are respectively used as a third signal end and a fourth signal end; switching the switch array to a first switch state to connect the first signal terminal with the third signal terminal and connect the second signal terminal with the fourth signal terminal; judging whether the first serial port equipment and the second serial port equipment are in normal communication or not; if so, judging that the serial port is correctly wired; if not, the switch array is switched to a second switch state, so that the first signal end is connected with the fourth signal end, and the second signal end is connected with the third signal end.
9. The switch-switching circuit of claim 6, further comprising:
and the indication module is connected with the control module and used for receiving a connection success indication signal sent by the control module after the control module controls the switch array in the switch switching circuit to switch the switch state based on the identification result.
10. The switch-switching circuit according to any of claims 6-9, wherein the switch array comprises a first switch, a second switch, a third switch, and a fourth switch;
two ends of the first switch are respectively connected with a first signal end of the first serial port and a third signal end of the second serial port;
two ends of the second switch are respectively connected with the first signal end of the first serial port and the fourth signal end of the second serial port;
two ends of the third switch are respectively connected with the second signal end of the first serial port and the third signal end of the second serial port;
two ends of the fourth switch are respectively connected with the second signal end of the first serial port and the fourth signal end of the second serial port;
the first switch to the fourth switch are specifically an optical coupler or a relay or a multiplexer.
CN201911292680.8A 2019-12-16 2019-12-16 Reverse connection preventing method for serial port signals and switch switching circuit Pending CN112988642A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911292680.8A CN112988642A (en) 2019-12-16 2019-12-16 Reverse connection preventing method for serial port signals and switch switching circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911292680.8A CN112988642A (en) 2019-12-16 2019-12-16 Reverse connection preventing method for serial port signals and switch switching circuit

Publications (1)

Publication Number Publication Date
CN112988642A true CN112988642A (en) 2021-06-18

Family

ID=76343188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911292680.8A Pending CN112988642A (en) 2019-12-16 2019-12-16 Reverse connection preventing method for serial port signals and switch switching circuit

Country Status (1)

Country Link
CN (1) CN112988642A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113709590A (en) * 2021-08-27 2021-11-26 锐捷网络股份有限公司 Method, device and system for adjusting line sequence of serial port circuit and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528476A (en) * 2016-11-24 2017-03-22 微鲸科技有限公司 Circuit capable of automatically realizing cross and direct connection serial port switching
CN106708769A (en) * 2015-07-16 2017-05-24 北京谊安医疗系统股份有限公司 Adaptive serial interface circuit
CN108563601A (en) * 2018-06-27 2018-09-21 大唐终端技术有限公司 The super adaption system of serial ports
CN208298168U (en) * 2018-06-29 2018-12-28 珠海市魅族科技有限公司 Serial communication debug circuit and terminal
CN109359078A (en) * 2018-12-10 2019-02-19 威创集团股份有限公司 A kind of self-adapting serial port interface circuit and its control method for middle control host

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106708769A (en) * 2015-07-16 2017-05-24 北京谊安医疗系统股份有限公司 Adaptive serial interface circuit
CN106528476A (en) * 2016-11-24 2017-03-22 微鲸科技有限公司 Circuit capable of automatically realizing cross and direct connection serial port switching
CN108563601A (en) * 2018-06-27 2018-09-21 大唐终端技术有限公司 The super adaption system of serial ports
CN208298168U (en) * 2018-06-29 2018-12-28 珠海市魅族科技有限公司 Serial communication debug circuit and terminal
CN109359078A (en) * 2018-12-10 2019-02-19 威创集团股份有限公司 A kind of self-adapting serial port interface circuit and its control method for middle control host

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113709590A (en) * 2021-08-27 2021-11-26 锐捷网络股份有限公司 Method, device and system for adjusting line sequence of serial port circuit and readable storage medium

Similar Documents

Publication Publication Date Title
CN108459982B (en) Communication equipment and switching method of USB and serial port
US7923988B2 (en) Test equipment and test system using the same
CN102783095A (en) Communication system, communication method, server device, communication device
CN107193697A (en) A kind of method for realizing the nonpolarity connections of RS485
CN104090511B (en) Circuit and method for achieving non-polar 485 communication
WO2009144843A1 (en) Communication system, test device, communication device, communication method, and test method
CN112988642A (en) Reverse connection preventing method for serial port signals and switch switching circuit
CN105467262A (en) Method and device for detection of connection error of display equipment terminal
US7631129B2 (en) Computer monitoring system and monitoring method
CN103676919B (en) A kind of test system of industrial control equipment
CN103116567A (en) Multi-serial-port selection circuit
CN1086091C (en) Data access apparatus
CN102693117B (en) Interface circuit and there is the electronic installation of interface circuit
CN213960082U (en) Isolation circuit and communication circuit
US9960990B2 (en) Systems and methods for monitoring and managing communication paths
KR20100111946A (en) The data-transmittable non-polarity rs-485 communication device of bms controller by automatic polarity discrimination
CN103701660A (en) Ethernet equipment connection device and testing system and method applied thereby
CN202794422U (en) Recommended standard (RS) 422 interface loop test jig
CN110312984B (en) Communication system
CN202111680U (en) Wireless control switch
WO2019049232A1 (en) Video device and connection determination method
TW200721736A (en) Automatic configuration system
US20100316374A1 (en) Networked mapping function
CN212515784U (en) RS-485 signal line polarity self-adaptation realization device based on double UARTs
CN214585758U (en) Port test circuit and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210618