Gateway machine external serial port debugging and communication troubleshooting method, module and device

By using a USB-to-serial converter and establishing a serial port three-way connection in the gateway device, the cumbersome problem of troubleshooting serial communication faults between the gateway and sensor devices was solved, enabling rapid and accurate fault location and troubleshooting, improving engineering debugging efficiency, and ensuring the reliability and stability of the system.

CN120614280BActive Publication Date: 2025-10-24NANJING ZHENGTU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511106180.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-10-24
Estimated Expiration
2045-08-08

AI Technical Summary

Technical Problem

Existing methods for troubleshooting serial communication faults between gateway devices and sensor devices are cumbersome, inefficient, and difficult to resolve quickly and accurately.

Method used

A USB-to-serial converter was used to establish a connection between the host computer and the gateway's serial port under test. By constructing a three-way connection between the debugging serial port, the serial port under test, and the sensor serial port, faults in the gateway and sensor serial ports were gradually screened. The configuration unit, message receiving unit, message generation unit, message sending unit, and content comparison unit were used for fault diagnosis.

Benefits of technology

It improves fault location efficiency, reduces troubleshooting costs and complexity, ensures the comprehensiveness and accuracy of fault diagnosis, is suitable for widespread application in engineering sites, and guarantees the reliability of data transmission between devices and the stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120614280B_ABST
    Figure CN120614280B_ABST
Patent Text Reader

Abstract

The application discloses a gateway machine external serial port debugging and communication troubleshooting method, module and device, belongs to the technology of power transformation and distribution station, and the method is connected with the gateway machine to be tested by a USB-to-serial tool, and a three-way relationship and a mapping relationship are constructed, combined with query messages, response messages and byte sequence streams, sensor serial port faults and gateway machine serial port faults can be quickly troubleshooted, the whole process is divided into system basic connection, serial port debugging, sensor serial port fault troubleshooting and gateway machine serial port fault troubleshooting stages, the core is a serial port debugging module, including a configuration unit, a message receiving unit, a message generating unit, a message sending unit, an auxiliary debugging unit and a content comparison unit. The application can effectively troubleshoot serial port faults, accurately locate problems, improve the debugging efficiency, does not need complex external equipment, is simple to operate, is suitable for engineering sites, and improves system operation stability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a gateway machine external serial port debugging and communication troubleshooting method, a serial port debugging module and a device, and belongs to the technical field of power distribution stations. BACKGROUND

[0002] As one of commonly used communication interfaces in gateway devices, a serial port (serial communication interface) is mainly used for low-speed, reliable and short-distance data communication between devices, and realizes information interaction between devices through a serial communication mode of transmitting data bit by bit. Compared with parallel communication, it has the advantages of simplifying wiring and enhancing anti-interference capability.

[0003] In gateway device, the serial port is widely used. For example, in an industrial gateway, PLC and sensor data are collected by means of RS-485 / Modbus protocol, and are converted into Ethernet or wireless signals to be uploaded to a cloud platform; in a smart home gateway, a TTL UART is used to connect a Zigbee and a LoRa module to realize access of low-power devices; in a device debugging and configuration scene, a RS-232 or USB-to-serial tool is used to upgrade firmware, capture logs or configure parameters of the gateway; in a serial port server, serial port data is encapsulated into a TCP / IP protocol (such as a TCP Socket), so as to realize remote device management, such as controlling serial port devices through the Internet.

[0004] However, in the engineering debugging process, abnormal situations often occur in serial port communication between the gateway machine and the sensor device. In addition to gateway machine serial port failure and sensor serial port failure, improper communication parameter configuration can also be one of the reasons. How to quickly locate the fault and troubleshoot the problem has become a big problem in engineering debugging. The existing troubleshooting methods may have problems such as dependence on additional external devices, cumbersome troubleshooting steps and low efficiency, and are difficult to meet the needs of quickly and accurately solving the fault in engineering debugging. SUMMARY

[0005] The application provides a gateway machine external serial port debugging and communication troubleshooting method, a serial port debugging module and a device to realize effective troubleshooting of serial port failure, accurate positioning of serial port communication problems and improvement of debugging efficiency.

[0006] Technical scheme: In order to achieve the above purpose, the technical scheme adopted by the application is as follows:

[0007] A gateway machine external serial port debugging and communication troubleshooting method, including a serial port debugging stage, a sensor serial port troubleshooting stage and a gateway machine serial port troubleshooting stage, comprising the following steps:

[0008] Step1、System basic connection: a USB-to-serial tool is used to establish a test signal connection between the host computer and the to-be-tested serial port of the gateway machine, the serial port on the USB-to-serial tool is called a debugging serial port, and the serial port is called a debugging serial port I during the gateway machine serial port troubleshooting stage. The to-be-tested serial port is an external serial port of the gateway machine, usually an external serial port that cannot collect sensor data, which is generally manifested as abnormal gateway machine data display;

[0009] Step2、Serial port debugging stage: first, connect the sensor serial port to the to-be-tested serial port of the gateway machine, open the debugging serial port, and build a three-way relationship among the debugging serial port, the to-be-tested serial port, and the sensor serial port; then, determine whether the debugging serial port can receive the query message sent by the to-be-tested serial port to the sensor serial port to preliminarily determine whether the gateway machine serial port has failed; then, determine whether the debugging serial port can receive the response message returned by the sensor serial port to the to-be-tested serial port to preliminarily determine whether the sensor serial port has failed;

[0010] Step3、Sensor serial port troubleshooting stage: first, connect the sensor serial port to the to-be-tested serial port of the gateway machine, open the debugging serial port, and build a three-way relationship among the debugging serial port, the to-be-tested serial port, and the sensor serial port; then, send a query message to the sensor serial port through the debugging serial port and receive the response message returned by the sensor serial port; then, determine whether the response message is abnormal to confirm whether the sensor serial port has failed;

[0011] Step4、Gateway machine serial port troubleshooting stage: first, another USB-to-serial tool is used to establish a test signal connection between the host computer and the auxiliary test serial port of the gateway machine, the serial port on the USB-to-serial tool is called a debugging serial port II, and the auxiliary test serial port is an external serial port of the gateway machine, usually a normally communicating external serial port; then, open the debugging serial port I to build a communication connection between the debugging serial port I and the to-be-tested serial port, open the debugging serial port II to build a communication connection between the debugging serial port II and the auxiliary test serial port, and set the to-be-tested serial port to write the collected data to the auxiliary test serial port without modification; finally, write byte stream I to the debugging serial port I, read byte stream II from the debugging serial port II, and compare whether the byte stream I and the byte stream II are consistent to confirm whether the to-be-tested serial port has failed.

[0012] Specifically, before opening the debugging serial port, the configuration information of the debugging serial port is set, which is the same as that of the to-be-tested serial port or the auxiliary test serial port connected thereto, including baud rate, parity bit, data bit, and stop bit.

[0013] Specifically, the serial port debugging stage includes the following steps:

[0014] Step 21, keep the connection between the debugging serial port and the to-be-tested serial port, the connection between the sensor serial port and the to-be-tested serial port, open the debugging serial port with the same configuration information as the to-be-tested serial port;

[0015] Step 22, take the gateway machine as a Modbus master station, and send a query message to the sensor serial port through the to-be-tested serial port at a fixed time, and enter step 23;

[0016] Step 23, if the query message cannot be received through the debugging serial port, it is preliminarily determined that the to-be-tested serial port has a fault; if the query message can be received through the debugging serial port, it indicates that the to-be-tested serial port sends messages normally, and enter step 24;

[0017] Step 24, if the response message returned by the sensor serial port cannot be received through the debugging serial port, it is preliminarily determined that the sensor serial port has a fault; if the response message returned by the sensor serial port can be received through the debugging serial port, it indicates that the to-be-tested serial port receives messages normally, and enter step 25;

[0018] Step 25, if the gateway machine data display is abnormal, it is preliminarily determined that the to-be-tested serial port has a fault; if the gateway machine data display is normal, enter step 26;

[0019] Step 26, disconnect the connection between the debugging serial port and the to-be-tested serial port: if the gateway machine data display is abnormal, it is preliminarily determined that the to-be-tested serial port has a fault; if the gateway machine data display is normal, the to-be-tested serial port communication is normal, and the debugging is completed.

[0020] Specifically, the sensor serial port troubleshooting stage includes the following steps:

[0021] Step 31, keep the connection between the debugging serial port and the to-be-tested serial port, the connection between the sensor serial port and the to-be-tested serial port, open the debugging serial port with the same configuration information as the to-be-tested serial port;

[0022] Step 32, send a query message to the sensor serial port through the debugging serial port, and enter step 33;

[0023] Step 33, if the response message returned by the sensor serial port can be received through the debugging serial port, enter step 34; if the response message returned by the sensor serial port cannot be received through the debugging serial port, enter step 35;

[0024] Step 34, determine whether the response message is abnormal: if not, it indicates that the sensor serial port fault problem is solved; if yes, enter step 35;

[0025] Step 35, judging whether there is an untried baud rate: if there is an untried baud rate, adjusting the baud rate of the debugging serial port to the untried baud rate, returning to step 32; if there is no untried baud rate, confirming that the sensor serial port is faulty.

[0026] Specifically, the gateway machine serial port troubleshooting phase includes the following steps:

[0027] Step 41, maintaining the connection between the debugging serial port I and the to-be-tested serial port, newly establishing the connection between the debugging serial port II and the auxiliary test serial port, and opening the debugging serial port I and the debugging serial port II;

[0028] Step 42, constructing the mapping relationship between the debugging serial port I and the debugging serial port II, and then binding the mapping relationship between the to-be-tested serial port and the auxiliary test serial port, setting the to-be-tested serial port to continuously collect data and write the collected data into the auxiliary test serial port;

[0029] Step 43, randomly forming a byte sequence stream I and writing it into the debugging serial port I, based on the mapping relationship between the to-be-tested serial port and the auxiliary test serial port, the to-be-tested serial port directly writing the collected byte sequence stream into the auxiliary test serial port, and the debugging serial port II receiving the byte sequence stream II from the auxiliary test serial port;

[0030] Step 44, comparing the byte sequence stream II read by the debugging serial port II with the byte sequence stream I written into the debugging serial port I: if the contents of the two are consistent, confirming that the to-be-tested serial port is in normal communication; if the contents of the two are inconsistent, confirming that the to-be-tested serial port is in abnormal communication.

[0031] A serial port debugging module includes a configuration unit, a message receiving unit, a message generating unit, a message sending unit, an auxiliary debugging unit, and a content comparison unit.

[0032] The configuration unit is configured to configure a debugging serial port, and the configuration information of the debugging serial port includes a baud rate, a parity bit, a data bit, and a stop bit; the debugging serial port is a serial port on a USB-to-serial tool, and the USB-to-serial tool is used to establish a test signal connection between an upper computer and a to-be-tested serial port of a gateway machine; in a serial port debugging phase and a sensor serial port troubleshooting phase, the sensor serial port needs to be connected to the to-be-tested serial port of the gateway machine at the same time;

[0033] The message receiving unit is configured to receive message data from the debugging serial port, including message data from the to-be-tested serial port and message data from the sensor serial port;

[0034] The message generating unit is configured to generate message data and send it to the message sending unit; including a query message generated in the sensor serial port troubleshooting phase, and further including a byte sequence stream generated in the gateway machine serial port troubleshooting phase;

[0035] The message sending unit is configured to send message data to the debugging serial port.

[0036] The auxiliary debugging unit is configured to construct a mapping relationship between the two debugging serial ports, and then bind the mapping relationship between the to-be-tested serial port and the auxiliary test serial port; the two debugging serial ports are referred to as debugging serial port I and debugging serial port II; the message generation unit is called to generate message data I, the message sending unit is called to send the message data I to the debugging serial port I, the message receiving unit is called to receive message data II from the debugging serial port II, and the content comparison unit is called to store the message data I and the message data II.

[0037] The content comparison unit is configured to store the message data I sent by the debugging serial port I and the message data II received by the debugging serial port II, and compare whether the message data I and the message data II are consistent; since the debugging serial port I, the debugging serial port II and the auxiliary test serial port are all normal communication serial ports, the to-be-tested serial port directly writes the collected byte sequence stream into the auxiliary test serial port; if the to-be-tested serial port communicates normally, the message data I and the message data II should have the same content; if the to-be-tested serial port communicates abnormally, the message data I cannot be correctly received, and then the message data I and the message data II will have inconsistent content.

[0038] A debugging and communication troubleshooting device for an external serial port of a gateway machine, comprising a host computer and a USB-to-serial tool, wherein the serial port debugging module is arranged in the host computer, and a test signal connection between the host computer and the external serial port of the gateway machine is established through the USB-to-serial tool; the serial port on the USB-to-serial tool is referred to as a debugging serial port.

[0039] Beneficial effects: The gateway machine external serial port debugging and communication troubleshooting method, serial port debugging module and device provided by the application have the following advantages compared with the prior art: 1. The application distinguishes gateway machine serial port faults and sensor serial port faults by the step-by-step screening method, provides an explicit troubleshooting direction for engineering debugging personnel, and greatly improves the fault positioning efficiency; 2. During the gateway machine serial port troubleshooting stage, only the detection program needs to be run to generate detection messages for comparison and inspection, without the aid of other complex external detection equipment, thereby reducing the cost and complexity of troubleshooting; 3. The entire troubleshooting process mainly relies on common USB-to-serial tools and upper computer software, and engineering debugging personnel only need to connect the cable according to the steps, open the debugging tool and observe the message transmission situation, which is simple to operate and easy to master, and is suitable for wide application in actual engineering sites; 4. By constructing the three-way relationship between the debugging serial port and the to-be-tested serial port and the sensor serial port, and the mapping relationship of the auxiliary test serial port, the actual communication scene of the gateway machine and the sensor can be comprehensively and systematically simulated, each link of the communication link is carefully detected, the comprehensiveness and accuracy of the debugging work are ensured, and the problem of repeated debugging caused by incomplete troubleshooting is effectively avoided; 5. The communication fault of the gateway machine external serial port is found and solved in time, which helps to ensure the normal and reliable data transmission between devices in the power distribution station and other systems, and further improves the operation reliability and stability of the entire system, which has important significance for protecting the normal operation of systems in the fields of industrial automation, smart home and the like. BRIEF DESCRIPTION OF DRAWINGS

[0040] Figure 1 It is a structural block diagram of the serial port debugging module.

[0041] Figure 2 It is a flowchart of the serial port debugging stage.

[0042] Figure 3 It is a flowchart of the sensor serial port troubleshooting stage.

[0043] Figure 4 It is a flowchart of the gateway machine serial port troubleshooting stage. DETAILED DESCRIPTION

[0044] The application will be specifically introduced below in combination with the drawings and specific embodiments.

[0045] A gateway machine external serial port debugging and communication troubleshooting device, comprising an upper computer and a USB-to-serial tool, and a serial port debugging module is arranged in the upper computer; the test signal connection between the upper computer and the external serial port of the gateway machine is established through the USB-to-serial tool, and the serial port on the USB-to-serial tool is called a debugging serial port.

[0046] As Figure 1The serial port debugging module comprises a configuration unit, a message receiving unit, a message generating unit, a message sending unit, an auxiliary debugging unit and a content comparison unit.

[0047] The configuration unit is configured to configure a debugging serial port, and the configuration information of the debugging serial port comprises a baud rate, a parity bit, a data bit and a stop bit.

[0048] The message receiving unit is configured to receive message data from the debugging serial port, and the message data comprises message data from the to-be-tested serial port and message data from the sensor serial port.

[0049] The message generating unit is configured to generate message data and send the message data to the message sending unit.

[0050] The message sending unit is configured to send the message data to the debugging serial port.

[0051] The auxiliary debugging unit is configured to construct a mapping relationship between two debugging serial ports, and then bind a mapping relationship between the to-be-tested serial port and the auxiliary testing serial port.

[0052] The content comparison unit is configured to store the message data I sent by the debugging serial port I and the message data II received by the debugging serial port II, and compare whether the message data I and the message data II are consistent.

[0053] The gateway machine external serial port debugging and communication fault troubleshooting method based on the above device comprises a serial port debugging stage, a sensor serial port fault troubleshooting stage and a gateway machine serial port fault troubleshooting stage.

[0054] Step 1. Basic connection of the system

[0055] When a certain external serial port of the gateway machine cannot collect the data output by the sensor, the external serial port is called the serial port to be tested. First, the basic connection of the system is performed on the serial port to be tested. The serial port debugging stage, the sensor serial port fault troubleshooting stage and the gateway machine serial port fault troubleshooting stage are all implemented based on the basic connection of the system.

[0056] The basic connection of the system is as follows: a test signal connection is established between the host computer (PC, such as a laptop device) and the serial port to be tested of the gateway machine through a USB serial conversion tool. The serial port on the USB serial conversion tool is called the debug serial port. During the gateway machine serial port troubleshooting phase, the debug serial port is called debug serial port I. The serial port to be tested is the external serial port of the gateway machine, which is usually an external serial port that cannot collect sensor data, which is generally manifested as abnormal data display on the gateway machine.

[0057] Step 2, serial port debugging stage

[0058] First, connect the sensor serial port to the serial port to be tested on the gateway machine, open the debug serial port, and establish a three-way relationship among the debug serial port, the serial port to be tested, and the sensor serial port; then, by determining whether the debug serial port can receive the query message sent by the serial port to be tested to the sensor serial port, preliminarily determine whether a gateway machine serial port failure occurs; then, by determining whether the debug serial port can receive the response message returned by the sensor serial port to the serial port to be tested, preliminarily determine whether a sensor serial port failure occurs.

[0059] After the debugging serial port, the serial port to be tested, and the sensor serial port establish a three-way relationship, if there is no communication failure, the data output by the sensor serial port can be received by the serial port to be tested and the debugging serial port at the same time. The serial port to be tested and the debugging serial port can both send information directly to the sensor. The information sent by the serial port to be tested to the sensor serial port can also be read by the debugging serial port. The information sent by the debugging serial port to the sensor serial port can also be read by the serial port to be tested.

[0060] like Figure 2 As shown in the figure, the specific execution process of the serial port debugging stage includes the following steps:

[0061] Step 21: Set or view the configuration information of the serial port to be tested in the gateway machine, including the baud rate, parity bit, data bits, and stop bits; in the configuration unit of the serial port debugging module, use the same configuration information to open the debugging serial port;

[0062] Step 22: Connect the sensor serial port to the serial port to be tested on the gateway machine, and establish a three-way relationship among the debugging serial port, the serial port to be tested, and the sensor serial port;

[0063] Step 23, the gateway machine as a Modbus master station, through the test serial port to the sensor serial port to send query message, step 24;

[0064] Step 24, if the message receiving unit can not receive the query message through the debugging serial port, it is preliminarily determined that the test serial port has a fault, and the gateway machine serial port troubleshooting needs to be performed, and the gateway machine serial port troubleshooting stage is entered; if the message receiving unit can receive the query message through the debugging serial port, it indicates that the test serial port sends the message normally, and step 25 is entered;

[0065] Step 25, if the message receiving unit can not receive the response message returned by the sensor serial port through the debugging serial port, it is preliminarily determined that the sensor serial port has a fault, and the sensor serial port troubleshooting needs to be performed, and the sensor serial port troubleshooting stage is entered; if the message receiving unit can receive the response message returned by the sensor serial port through the debugging serial port, it indicates that the test serial port receives the message normally, and step 26 is entered;

[0066] Step 26, if the gateway machine data display is abnormal, it is preliminarily determined that the test serial port has a fault, and the gateway machine serial port troubleshooting needs to be performed, and the gateway machine serial port troubleshooting stage is entered; if the gateway machine data display is normal, step 27 is entered;

[0067] Step 27, disconnect the connection between the debugging serial port and the test serial port: if the gateway machine data display changes from normal to abnormal, and the test serial port needs to be executed and capacitance needs to be handled, it is preliminarily determined that the test serial port has a fault, and the gateway machine serial port troubleshooting needs to be performed, and the gateway machine serial port troubleshooting stage is entered; if the gateway machine data display is normal, the test serial port communication is normal, and the debugging is completed.

[0068] Step 3, sensor serial port troubleshooting stage

[0069] First, the sensor serial port is connected to the test serial port of the gateway machine, the debugging serial port is opened, and the three-way relationship of the debugging serial port, the test serial port and the sensor serial port is constructed; then, the query message is sent to the sensor serial port through the debugging serial port, and the response message returned by the sensor serial port is received; then, whether the sensor serial port has a fault is confirmed by judging whether the response message is abnormal. As shown in the figure, Figure 3 the specific execution process of the sensor serial port troubleshooting includes the following steps:

[0070] Step 31, keep the connection between the debugging serial port and the test serial port, and the connection between the sensor serial port and the test serial port, and open the debugging serial port by using the same configuration information as the test serial port;

[0071] Step 32: Generate a query message through the message generating unit, and the message sending unit sends the query message to the sensor serial port through the debugging serial port, and then proceed to step 33;

[0072] Step 33: If the message receiving unit can receive the response message returned by the sensor serial port through the debugging serial port, then proceed to step 34; If the message receiving unit cannot receive the response message returned by the sensor serial port through the debugging serial port, then proceed to step 35;

[0073] Step 34: Determine whether the response message is abnormal. If no abnormality is found, the sensor serial port fault has been resolved. If abnormality is found, proceed to step 35.

[0074] Step 35, determine whether there is an untried baud rate: if there is an untried baud rate, adjust the baud rate of the debug serial port to the untried baud rate in the configuration unit, and return to step 32; if there is no untried baud rate, confirm that the sensor serial port is faulty.

[0075] Step 4: Gateway serial port troubleshooting stage

[0076] First, establish a test signal connection between the host computer and the auxiliary test serial port of the gateway machine through another USB serial conversion tool. The serial port on the USB serial conversion tool is called the debug serial port II. The auxiliary test serial port is the external serial port of the gateway machine. In this case, it is selected as the external serial port for normal communication. Then, open the debug serial port I to build a communication connection between the debug serial port I and the serial port to be tested. Open the debug serial port II to build a communication connection between the debug serial port II and the auxiliary test serial port. Set the serial port to be tested to write the collected data intact to the auxiliary test serial port. Finally, write byte sequence stream I to the debug serial port I, read byte sequence stream II from the debug serial port II, and confirm whether a fault has occurred in the serial port to be tested by comparing whether the byte sequence stream I is consistent with the byte sequence stream II. Figure 4 As shown in the figure, the specific execution process of gateway serial port fault troubleshooting includes the following steps:

[0077] Step 41: Maintain the connection between the debugging serial port 1 and the serial port to be tested ( Figure 4 AA on the left is a group of connections, and BB on the left is a group of connections). Create a new connection between the debug serial port II and the auxiliary test serial port ( Figure 4 AA on the right is a group of connections, and BB on the right is a group of connections). Open debug serial port I and debug serial port II;

[0078] Step 42: Construct a mapping relationship between the debugging serial port I and the debugging serial port II through the auxiliary debugging unit ( Figure 4 The AA on the lower middle side forms a group of mappings, and the BB on the lower side forms a group of mappings), thereby binding the mapping relationship between the serial port to be tested and the auxiliary test serial port (Figure 4 The A-A on the middle upper side forms a set of mapping, and the B-B on the upper side forms a set of mapping, the serial port to be tested is set to continuously collect data, and the collected data is written into the auxiliary test serial port without change;

[0079] In step 43, a byte sequence stream I is randomly formed by a message generation unit, the byte sequence stream I is written into the debugging serial port I by a message sending unit, based on the mapping relationship between the serial port to be tested and the auxiliary test serial port, the byte sequence stream collected by the serial port to be tested is directly written into the auxiliary test serial port, and the byte sequence stream II from the auxiliary test serial port is received by the message receiving unit through the debugging serial port II. Figure 4 In the middle, the byte sequence stream from the left A serial port on the lower side is output from the right A serial port on the lower side, and the byte sequence stream from the left B serial port on the lower side is output from the right B serial port on the lower side.

[0080] In step 44, the byte sequence stream I and the byte sequence stream II are both sent into a content comparison unit, the byte sequence stream I and the byte sequence stream II are compared in the content comparison unit: if the contents are consistent, it is confirmed that the communication of the serial port to be tested is normal; if the contents are inconsistent, it is confirmed that the communication of the serial port to be tested is abnormal.

[0081] The basic principles, main features and advantages of the present application are shown and described above. It should be understood by those skilled in the art that the above examples do not limit the present application in any form, and any technical solutions obtained by equivalent replacement or equivalent transformation fall within the protection scope of the present application.

Claims

1. A method for debugging an external serial port of a gateway and troubleshooting communication faults, characterized by: The method comprises a serial port debugging stage, a sensor serial port troubleshooting stage and a gateway machine serial port troubleshooting stage, and comprises the following steps. Step 1, basic connection of the system: a USB-to-serial tool is used to establish a test signal connection between the host computer and the to-be-tested serial port of the gateway machine, and the serial port on the USB-to-serial tool is referred to as a debugging serial port. In the gateway machine serial port troubleshooting stage, the debugging serial port is referred to as debugging serial port I. Step 2, serial port debugging stage: first, the sensor serial port is connected to the to-be-tested serial port of the gateway machine, the debugging serial port is opened, and a three-way relationship of the debugging serial port, the to-be-tested serial port and the sensor serial port is established; then, whether the debugging serial port can receive the query message sent by the to-be-tested serial port to the sensor serial port is determined, and whether the gateway machine serial port fault occurs is preliminarily determined; then, whether the debugging serial port can receive the response message returned by the sensor serial port to the to-be-tested serial port is determined, and whether the sensor serial port fault occurs is preliminarily determined. Step 3, sensor serial port troubleshooting stage: first, the sensor serial port is connected to the to-be-tested serial port of the gateway machine, the debugging serial port is opened, and a three-way relationship of the debugging serial port, the to-be-tested serial port and the sensor serial port is established; then, the debugging serial port sends a query message to the sensor serial port and receives a response message returned by the sensor serial port; then, whether the response message is abnormal is judged, and whether the sensor serial port fault occurs is confirmed. Step 4, gateway machine serial port troubleshooting stage: first, another USB-to-serial tool is used to establish a test signal connection between the host computer and the auxiliary test serial port of the gateway machine, and the serial port on the USB-to-serial tool is referred to as debugging serial port II. Then, the debugging serial port I is opened to establish a communication connection between the debugging serial port I and the to-be-tested serial port, the debugging serial port II is opened to establish a communication connection between the debugging serial port II and the auxiliary test serial port, and the to-be-tested serial port is set to write the collected data into the auxiliary test serial port without any change. Finally, byte sequence stream I is written into the debugging serial port I, byte sequence stream II is read from the debugging serial port II, and whether the byte sequence stream I and the byte sequence stream II are consistent is compared to confirm whether the to-be-tested serial port fault occurs.

2. The method for debugging and troubleshooting of external serial port of the gateway machine according to claim 1, characterized in that: Before the debugging serial port is opened, the configuration information of the debugging serial port is set, and the configuration information of the debugging serial port is the same as that of the to-be-tested serial port or the auxiliary test serial port connected thereto, including baud rate, parity bit, data bit and stop bit.

3. The method of claim 1, wherein the method further comprises: The serial port debugging stage comprises the following steps. Step 21, the connection between the debugging serial port and the to-be-tested serial port is maintained, the connection between the sensor serial port and the to-be-tested serial port is maintained, and the debugging serial port is opened with the same configuration information as the to-be-tested serial port; Step 22, the gateway machine is used as a Modbus master station, a query message is sent to the sensor serial port through the to-be-tested serial port at a predetermined time, and step 23 is entered; Step 23, if the query message cannot be received through the debugging serial port, it is preliminarily determined that the to-be-tested serial port has a fault; if the query message can be received through the debugging serial port, it indicates that the to-be-tested serial port sends messages normally, and step 24 is entered; Step 24, if the response message returned by the sensor serial port cannot be received through the debugging serial port, it is preliminarily determined that the sensor serial port is faulty; if the response message returned by the sensor serial port can be received through the debugging serial port, it indicates that the message received by the to-be-tested serial port is normal, and step 25 is entered; Step 25, if the gateway machine data display is abnormal, it is preliminarily determined that the to-be-tested serial port is faulty; If the gateway machine data display is normal, step 26 is entered; Step 26, disconnect the connection between the debugging serial port and the to-be-tested serial port: if the gateway machine data display is abnormal, it is preliminarily determined that the to-be-tested serial port is faulty; If the gateway machine data display is normal, the to-be-tested serial port communication is normal, and the debugging is completed.

4. The method of claim 1, wherein the method further comprises: The sensor serial port troubleshooting stage includes the following steps: Step 31, keep the connection between the debugging serial port and the to-be-tested serial port, and open the debugging serial port using the same configuration information as the to-be-tested serial port between the sensor serial port and the to-be-tested serial port; Step 32, send a query message to the sensor serial port through the debugging serial port, and enter step 33; Step 33, if the response message returned by the sensor serial port can be received through the debugging serial port, step 34 is entered; if the response message returned by the sensor serial port cannot be received through the debugging serial port, step 35 is entered; Step 34, determine whether the response message is abnormal: if not, it indicates that the sensor serial port fault problem is solved; if yes, step 35 is entered; Step 35, determine whether there is an untried baud rate: if there is an untried baud rate, the baud rate of the debugging serial port is adjusted to the untried baud rate, and step 32 is returned; if there is no untried baud rate, the sensor serial port fault is confirmed.

5. The method of claim 1, wherein the method further comprises: The gateway machine serial port troubleshooting stage includes the following steps: Step 41, keep the connection between the debugging serial port I and the to-be-tested serial port, and newly establish the connection between the debugging serial port II and the auxiliary test serial port, and open the debugging serial port I and the debugging serial port II; Step 42, build the mapping relationship between the debugging serial port I and the debugging serial port II, and then bind the mapping relationship between the to-be-tested serial port and the auxiliary test serial port, set the to-be-tested serial port to continuously collect data, and write the collected data into the auxiliary test serial port without change; Step 43, randomly form a byte sequence stream I and write it into the debugging serial port I, based on the mapping relationship between the to-be-tested serial port and the auxiliary test serial port, the to-be-tested serial port directly writes the collected byte sequence stream into the auxiliary test serial port, and the debugging serial port II receives the byte sequence stream II from the auxiliary test serial port; Step 44, compare the byte sequence stream II read by the debugging serial port II with the byte sequence stream I written into the debugging serial port I: if the contents are consistent, it is confirmed that the to-be-tested serial port communication is normal; If the contents are inconsistent, it is confirmed that the to-be-tested serial port communication is abnormal.

6. A serial port debugging module for implementing the method for debugging and troubleshooting communication faults of the external serial port of the gateway machine according to any one of claims 1-5, characterized in that: It comprises a configuration unit, a message receiving unit, a message generating unit, a message sending unit, an auxiliary debugging unit and a content comparison unit; The configuration unit is used for configuring the debugging serial port, and the configuration information of the debugging serial port includes baud rate, parity bit, data bit and stop bit; The message receiving unit is used for receiving message data from the debugging serial port; The message generating unit is configured to generate message data and send the message data to the message sending unit; The message sending unit is configured to send the message data to the debugging serial port; The auxiliary debugging unit is configured to build a mapping relationship between the two debugging serial ports, which are referred to as debugging serial port I and debugging serial port II respectively; The message generating unit is called to generate message data I, the message sending unit is called to send the message data I to the debugging serial port I, the message receiving unit is called to receive message data II from the debugging serial port II, and the content comparison unit is called to store the message data I and the message data II; The content comparison unit is configured to store the message data I sent by the debugging serial port I and the message data II received by the debugging serial port II, and compare whether the message data I and the message data II are consistent.

7. A gateway machine external serial port debugging and communication troubleshooting device, characterized in that: The USB-to-serial tool is connected to the gateway computer through the debugging serial port I, and the gateway computer is connected to the upper computer through the debugging serial port II.

Citation Information

Patent Citations

  • Online monitoring method based on transformer substation operation and maintenance network shutdown

    CN105629103A

  • Debugging workstation, gateway machine and power data remote acquisition method

    CN110995794A