Method, module and device for debugging external serial port and troubleshooting communication fault of gateway machine

By establishing a three-way relationship and mapping relationship between the debugging serial port and the serial port to be tested and the sensor serial port, and using USB serial conversion tools and host computer software, the gateway and sensor serial port faults are gradually checked. This solves the problem of low efficiency in serial port communication fault troubleshooting in the existing technology, and achieves fast and accurate fault location and stable data transmission between devices.

CN120614280AActive Publication Date: 2025-09-09NANJING ZHENGTU INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing methods for troubleshooting serial port communication faults between gateway devices and sensor devices are cumbersome and inefficient, making it difficult to quickly and accurately locate the cause of the fault, especially the difficulty in distinguishing between gateway serial port faults and sensor serial port faults.

Method used

A step-by-step screening method is adopted. The test signal connection between the host computer and the gateway computer is established through the USB serial conversion tool. The three-way relationship between the debugging serial port and the serial port to be tested and the sensor serial port is constructed. The configuration unit, message receiving unit, message generating unit, message sending unit and content comparison unit are used to gradually troubleshoot the gateway computer and sensor serial port faults. The auxiliary debugging unit is used to build a mapping relationship for fault location.

Benefits of technology

It improves the efficiency of fault location, reduces the cost and complexity of troubleshooting, ensures the comprehensiveness and accuracy of troubleshooting, is suitable for wide application on engineering sites, ensures the normal reliability of data transmission between devices, and improves the operational reliability and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120614280A_ABST
    Figure CN120614280A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a module and a device for debugging an external serial port of a gateway machine and troubleshooting communication faults, and belongs to the technology of power transformation and distribution stations, the method comprises the following steps: establishing connection between an upper computer and a to-be-tested serial port of the gateway machine through a USB (Universal Serial Bus)-to-serial tool, constructing a three-way relationship and a mapping relationship, and combining a query message, a response message and a byte sequence flow to realize debugging of the external serial port of the gateway machine; sensor serial port faults and gateway machine serial port faults can be rapidly checked, the whole process is divided into the stages of system basic connection, serial port debugging, sensor serial port fault checking and gateway machine serial port fault checking, and the core is a serial port debugging module. Comprising a configuration unit, a message receiving unit, a message generation unit, a message sending unit, an auxiliary debugging unit and a content comparison unit. The serial port fault can be effectively checked, the problem can be accurately positioned, the debugging efficiency is improved, complicated external equipment is not needed, the operation is simple, the method is suitable for an engineering field, and the system operation stability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for debugging an external serial port of a gateway machine and troubleshooting communication faults, a serial port debugging module and a device, and belongs to the technology of transformer substations. Background Art

[0002] Serial ports (serial communication interfaces), a common communication interface in gateway devices, are primarily used for low-speed, reliable, and short-range data communication between devices. They enable information exchange between devices by transmitting data bit by bit. Compared to parallel communication, serial ports offer the advantages of simplified wiring and enhanced interference resistance. Serial ports are widely used in gateway devices. For example, in industrial gateways, RS-485 / Modbus protocols are used to collect PLC and sensor data, converting it into Ethernet or wireless signals and uploading it to cloud platforms. In smart home gateways, TTL UARTs are used to connect Zigbee and LoRa modules to enable access to low-power devices. In device debugging and configuration scenarios, RS-232 or USB-to-serial conversion tools are used to upgrade gateway firmware, capture logs, or configure parameters. In serial port servers, serial port data is encapsulated into TCP / IP protocols (such as TCP Sockets) to enable remote device management, such as controlling serial devices over the internet. However, during engineering commissioning, serial communication anomalies between the gateway and sensor devices often occur. Besides gateway and sensor serial port failures, improper communication parameter configuration can also be a contributing factor. Quickly locating and troubleshooting the problem has become a major challenge during engineering commissioning. Existing troubleshooting methods can rely on external equipment, involve cumbersome procedures, and be inefficient, making them inefficient and unable to meet the demands of fast and accurate troubleshooting during engineering commissioning. Summary of the Invention

[0003] Purpose of the invention: In order to overcome the deficiencies in the prior art, the present invention provides a method for debugging and troubleshooting the external serial port of a gateway machine, a serial port debugging module and a device, so as to effectively troubleshoot serial port faults, accurately locate serial port communication problems, and improve debugging efficiency.

[0004] Technical solution: To achieve the above purpose, the technical solution adopted by the present invention is: A method for debugging an external serial port of a gateway and troubleshooting communication faults includes a serial port debugging stage, a sensor serial port troubleshooting stage, and a gateway serial port troubleshooting stage, including the following steps: Step 1. Basic system connection: Use a USB-to-serial converter to establish a test signal connection between the host computer and the serial port to be tested on the gateway. The serial port on the USB-to-serial converter is called the debug serial port. During the gateway serial port troubleshooting phase, this debug serial port is called debug serial port 1. The serial port to be tested is the external serial port of the gateway, which is usually unable to collect sensor data. This is usually manifested as abnormal data display on the gateway. Step 2, serial port debugging phase: First, connect the sensor serial port to the serial port to be tested on the gateway machine, open the debugging serial port, and establish a three-way relationship among the debugging serial port, the serial port to be tested, and the sensor serial port. Then, by determining whether the debugging serial port can receive the query message sent by the serial port to be tested to the sensor serial port, it is preliminarily determined whether a gateway machine serial port fault has occurred. Next, by determining whether the debugging serial port can receive the response message returned by the sensor serial port to the serial port to be tested, it is preliminarily determined whether a sensor serial port fault has occurred. Step 3, Sensor serial port troubleshooting phase: 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 between the debug serial port, the serial port to be tested, and the sensor serial port. Then, send a query message to the sensor serial port through the debug serial port and receive a response message returned by the sensor serial port. Then, determine whether the response message is abnormal to confirm whether a sensor serial port fault has occurred. Step 4, gateway serial port fault troubleshooting stage: First, establish a test signal connection between the host computer and the auxiliary test serial port of the gateway computer through another USB serial conversion tool. The serial port on the USB serial conversion tool is called debug serial port II, and the auxiliary test serial port is the external serial port of the gateway computer, usually the external serial port for normal communication; then, open debug serial port I to establish a communication connection between debug serial port I and the serial port to be tested, open debug serial port II to establish a communication connection between debug serial port II and the auxiliary test serial port, and set the serial port to be tested to write the collected data intact to the auxiliary test serial port; finally, write byte stream I to debug serial port I, read byte stream II from debug serial port II, and confirm whether a serial port to be tested fault occurs by comparing whether byte stream I is consistent with byte stream II.

[0005] Specifically, before opening the debug serial port, first set the configuration information of the debug serial port. The configuration information of the debug serial port is the same as that of the connected serial port to be tested or the auxiliary test serial port, including baud rate, parity bit, data bit and stop bit.

[0006] Specifically, the serial port debugging stage includes the following steps: Step 21: Maintain the connection between the debugging serial port and the serial port to be tested, and between the sensor serial port and the serial port to be tested, and open the debugging serial port with the same configuration information as the serial port to be tested; Step 22: Use the gateway as the Modbus master station and periodically send query messages to the sensor serial port through the serial port to be tested, and then go to step 23; Step 23: If the query message cannot be received through the debug serial port, it is preliminarily determined that the serial port to be tested is faulty; if the query message can be received through the debug serial port, it indicates that the serial port to be tested is sending messages normally, and the process proceeds to step 24; Step 24: If the debug serial port cannot receive the response message returned by the sensor serial port, it is preliminarily determined that the sensor serial port is faulty; if the debug serial port can receive the response message returned by the sensor serial port, it indicates that the serial port to be tested is receiving messages normally, and the process proceeds to step 25. Step 25: If the gateway machine data display is abnormal, it is preliminarily determined that the serial port to be tested is faulty; if the gateway machine data display is normal, proceed to step 26; Step 26: Disconnect the debugging serial port from the serial port to be tested. If the gateway data display is abnormal, it is preliminarily determined that the serial port to be tested has a fault. If the gateway data display is normal, the serial port to be tested communicates normally, and the debugging is completed.

[0007] Specifically, the sensor serial port fault troubleshooting stage includes the following steps: Step 31: Maintain the connection between the debugging serial port and the serial port to be tested, and between the sensor serial port and the serial port to be tested, and open the debugging serial port with the same configuration information as the serial port to be tested; Step 32: Send a query message to the sensor serial port through the debug serial port, and go to step 33; Step 33: If the response message returned by the sensor serial port can be received through the debugging serial port, then go to step 34; if the response message returned by the sensor serial port cannot be received through the debugging serial port, then go to step 35; 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. 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, and return to step 32; if there is no untried baud rate, confirm that the sensor serial port is faulty.

[0008] Specifically, the gateway serial port fault troubleshooting stage includes the following steps: Step 41: Maintain the connection between the debugging serial port I and the serial port to be tested, create a new 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: Establish a mapping relationship between the debug serial port I and the debug serial port II, and then bind the mapping relationship between the serial port to be tested and the auxiliary test serial port. Set the serial port to be tested to continuously collect data, and write the collected data intact to the auxiliary test serial port. Step 43: randomly generate a byte sequence stream I and write it to the debugging serial port I. Based on the mapping relationship between the serial port to be tested and the auxiliary test serial port, the serial port to be tested directly writes the collected byte sequence stream to 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 stream II read by the debugging serial port II with the byte stream I written into the debugging serial port I. If the two contents are consistent, the communication of the serial port to be tested is confirmed to be normal; if the two contents are inconsistent, the communication of the serial port to be tested is confirmed to be abnormal.

[0009] 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 comparing unit; The configuration unit is used to configure the debug serial port. The configuration information of the debug serial port includes the baud rate, parity bit, data bit and stop bit. The debug serial port is the serial port on the USB serial conversion tool. The USB serial conversion tool is used to establish a test signal connection between the host computer and the serial port to be tested of the gateway machine. During the serial port debugging stage and the sensor serial port troubleshooting stage, the sensor serial port needs to be connected to the serial port to be tested of the gateway machine at the same time. The message receiving unit is used to receive message data from the debugging serial port, including message data from the serial port to be tested and message data from the sensor serial port; The message generating unit is used to generate message data and send it to the message sending unit; including the query message generated in the sensor serial port fault troubleshooting stage, and also includes the byte sequence stream generated in the gateway serial port fault troubleshooting stage; The message sending unit is used to send message data to the debugging serial port; The auxiliary debugging unit is used to establish a mapping relationship between the two debugging serial ports, and then bind the mapping relationship between the serial port to be tested and the auxiliary test serial port; the two debugging serial ports are respectively referred to as debugging serial port I and debugging serial port II; calling the message generating unit to generate message data I, calling the message sending unit to send message data I to the debugging serial port I, calling the message receiving unit to receive message data II from the debugging serial port II, and calling the content comparing unit to store message data I and message data II; The content comparison unit is used to store message data I sent by debugging serial port I and message data II received by debugging serial port II, and compare whether message data I and message data II are consistent; since debugging serial port I, debugging serial port II and auxiliary test serial port are all normal communication serial ports, the serial port to be tested directly writes the collected byte sequence stream into the auxiliary test serial port. If the communication of the serial port to be tested is normal, the content of message data I and message data II should be the same; if the communication of the serial port to be tested is abnormal, message data I cannot be received correctly, which will lead to inconsistency between the content of message data I and message data II.

[0010] A device for debugging an external serial port of a gateway machine and troubleshooting communication faults includes a host computer and a USB-to-serial conversion tool. The host computer is provided with the above-mentioned serial port debugging module. A test signal connection is established between the host computer and the external serial port of the gateway machine through the USB-to-serial conversion tool. The serial port on the USB-to-serial conversion tool is called a debugging serial port.

[0011] Beneficial effects: The external serial port debugging and communication fault troubleshooting method, serial port debugging module and device of the gateway machine provided by the present invention have the following advantages over the existing technology: 1. The present invention distinguishes between gateway machine serial port faults and sensor serial port faults through a step-by-step screening method, provides a clear troubleshooting direction for engineering debugging personnel, and greatly improves the efficiency of fault location; 2. In the gateway machine serial port fault troubleshooting stage, it is only necessary to run the detection program to randomly generate detection messages for comparison and inspection, without the help of other complex external detection equipment, thus reducing the cost and complexity of troubleshooting; 3. The entire troubleshooting process mainly relies on common USB serial conversion tools and host computer software. Engineering debugging personnel only need to follow the steps to connect the cable, open the debugging tool and observe the message reception It is simple to operate and easy to use, suitable for wide application in actual engineering sites; 4. By building a three-way relationship between the debugging serial port and the serial port to be tested and the sensor serial port, as well as the mapping relationship between the auxiliary test serial port, it can comprehensively and systematically simulate the actual communication scenario between the gateway and the sensor, and conduct detailed inspections on each link of the communication link to ensure the comprehensiveness and accuracy of the debugging work, and effectively avoid repeated debugging problems caused by incomplete troubleshooting; 5. Timely discovery and resolution of communication failures of the gateway's external serial port helps to ensure normal and reliable data transmission between equipment in systems such as substations, thereby improving the operational reliability and stability of the entire system, which is of great significance to ensuring the normal operation of systems in industrial automation, smart home and other fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 This is the structural diagram of the serial port debugging module; Figure 2 This is a flowchart of the serial port debugging phase; Figure 3This is a flowchart of the sensor serial port troubleshooting phase; Figure 4 This is a flowchart of the gateway serial port troubleshooting phase. DETAILED DESCRIPTION

[0013] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0014] A device for debugging an external serial port of a gateway machine and troubleshooting communication faults includes a host computer and a USB serial conversion tool. A serial port debugging module is provided in the host computer. A test signal connection is established between the host computer and the external serial port of the gateway machine through the USB serial conversion tool. The serial port on the USB serial conversion tool is called a debugging serial port.

[0015] like Figure 1 As shown, the 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 comparing unit.

[0016] The configuration unit is used to configure the debug serial port, and the configuration information of the debug serial port includes the baud rate, parity bit, data bit and stop bit; the debug serial port is the serial port on the USB serial conversion tool, and the USB serial conversion tool is used to establish a test signal connection between the host computer and the serial port to be tested of the gateway machine; during the serial port debugging stage and the sensor serial port troubleshooting stage, the sensor serial port needs to be connected to the serial port to be tested of the gateway machine at the same time.

[0017] The message receiving unit is used to receive message data from the debugging serial port, including message data from the serial port to be tested and message data from the sensor serial port.

[0018] The message generating unit is used to generate message data and send it to the message sending unit; including the query message generated in the sensor serial port fault troubleshooting stage, and also includes the byte sequence stream generated in the gateway serial port fault troubleshooting stage; The message sending unit is used to send message data to the debugging serial port.

[0019] The auxiliary debugging unit is used to establish a mapping relationship between the two debugging serial ports, and then bind the mapping relationship between the serial port to be tested and the auxiliary test serial port; the two debugging serial ports are respectively called debugging serial port I and debugging serial port II; call the message generation unit to generate message data I, call the message sending unit to send message data I to the debugging serial port I, call the message receiving unit to receive message data II from the debugging serial port II, and call the content comparison unit to store message data I and message data II.

[0020] The content comparison unit is used to store message data I sent by debugging serial port I and message data II received by debugging serial port II, and compare whether message data I and message data II are consistent; since debugging serial port I, debugging serial port II and auxiliary test serial port are all normal communication serial ports, the serial port to be tested directly writes the collected byte sequence stream into the auxiliary test serial port. If the communication of the serial port to be tested is normal, the content of message data I and message data II should be the same; if the communication of the serial port to be tested is abnormal, message data I cannot be received correctly, which will lead to inconsistency between the content of message data I and message data II.

[0021] The external serial port debugging and communication troubleshooting method of the gateway machine based on the above-mentioned device includes a serial port debugging stage, a sensor serial port troubleshooting stage and a gateway machine serial port troubleshooting stage. The method part of the present invention is specifically described below in combination with the specific implementation process of each stage.

[0022] Step 1. Basic connection of the system 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.

[0023] 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.

[0024] Step 2, serial port debugging stage 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.

[0025] 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.

[0026] like Figure 2 As shown in the figure, the specific execution process of the serial port debugging stage includes the following steps: 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; 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; Step 23: Use the gateway as the Modbus master station and periodically send query messages to the sensor serial port through the serial port to be tested, and then go to step 24; Step 24: If the message receiving unit cannot receive the query message through the debug serial port, it is preliminarily determined that the serial port to be tested is faulty and it is necessary to perform gateway serial port troubleshooting, and enter the gateway serial port troubleshooting stage; if the message receiving unit can receive the query message through the debug serial port, it indicates that the serial port to be tested is sending messages normally, and enter step 25; Step 25: If the message receiving unit cannot receive the response message returned by the sensor serial port through the debug serial port, it is preliminarily determined that the sensor serial port is faulty and it is necessary to perform sensor serial port troubleshooting, and the process enters the sensor serial port troubleshooting phase. If the message receiving unit can receive the response message returned by the sensor serial port through the debug serial port, it indicates that the serial port to be tested is receiving messages normally, and the process enters step 26. Step 26: If the gateway machine data display is abnormal, it is preliminarily determined that the serial port to be tested is faulty and it is necessary to perform gateway machine serial port fault troubleshooting, entering the gateway machine serial port fault troubleshooting stage; if the gateway machine data display is normal, proceed to step 27; Step 27. Disconnect the debugging serial port from the serial port to be tested. If the data displayed by the gateway machine changes from normal to abnormal, it is usually necessary to perform processing such as connecting a capacitor in parallel on the serial port to be tested. It is preliminarily determined that there is a fault in the serial port to be tested, and it is necessary to troubleshoot the gateway machine serial port fault and enter the gateway machine serial port troubleshooting stage. If the data displayed by the gateway machine is normal and the serial port to be tested communicates normally, the debugging is completed.

[0027] Step 3: Sensor serial port troubleshooting 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, send a query message to the sensor serial port through the debug serial port, and receive the response message returned by the sensor serial port; then, determine whether the response message is abnormal to confirm whether a sensor serial port fault has occurred. Figure 3 As shown in the figure, the specific execution process of sensor serial port fault troubleshooting includes the following steps: Step 31: Maintain the connection between the debugging serial port and the serial port to be tested, and between the sensor serial port and the serial port to be tested, and open the debugging serial port with the same configuration information as the serial port to be tested; 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; 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; 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. 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.

[0028] Step 4: Gateway serial port troubleshooting stage 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: Step 41: Maintain the connection between the debugging serial port 1 and the serial port to be tested ( Figure 4AA 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; 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 AA on the upper middle side forms a group of mappings, and the BB on the upper side forms a group of mappings). Set the serial port to be tested to continuously collect data, and write the collected data intact to the auxiliary test serial port. Step 43: A string of byte sequence streams I is randomly generated by the message generating unit, and the byte sequence stream I is written into the debugging serial port I by the message sending unit. Based on the mapping relationship between the serial port to be tested and the auxiliary test serial port, the serial port to be tested directly writes the collected byte sequence stream into the auxiliary test serial port, and the message receiving unit receives the byte sequence stream II from the auxiliary test serial port through the debugging serial port II ( Figure 4 In the figure, the byte order stream sent from the serial port A on the lower left will output the result from the serial port A on the lower right, and the byte order stream sent from the serial port B on the lower left will output the result from the serial port B on the lower right); Step 44 , byte order stream I and byte order stream II are both sent to the content comparison unit, which compares byte order stream I and byte order stream II. If the contents of the two are consistent, it is confirmed that the communication of the serial port to be tested is normal; if the contents of the two are inconsistent, it is confirmed that the communication of the serial port to be tested is abnormal.

[0029] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the present invention in any form, and any technical solutions obtained by equivalent replacement or equivalent transformation fall within the scope of protection of the present invention.

Claims

1. A method for debugging an external serial port of a gateway and troubleshooting communication faults, characterized by: This includes the serial port debugging phase, the sensor serial port troubleshooting phase, and the gateway serial port troubleshooting phase, and includes the following steps: Step 1. Basic connection of the system: Use a USB to serial converter to establish a test signal connection between the host computer and the serial port to be tested on the gateway. The serial port on the USB to serial converter is called the debug serial port. During the gateway serial port troubleshooting phase, this debug serial port is called debug serial port 1. Step 2, serial port debugging phase: First, connect the sensor serial port to the serial port to be tested on the gateway machine, open the debugging serial port, and establish a three-way relationship among the debugging serial port, the serial port to be tested, and the sensor serial port. Then, by determining whether the debugging serial port can receive the query message sent by the serial port to be tested to the sensor serial port, it is preliminarily determined whether a gateway machine serial port fault has occurred. Next, by determining whether the debugging serial port can receive the response message returned by the sensor serial port to the serial port to be tested, it is preliminarily determined whether a sensor serial port fault has occurred. Step 3, Sensor serial port troubleshooting phase: 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 between the debug serial port, the serial port to be tested, and the sensor serial port. Then, send a query message to the sensor serial port through the debug serial port and receive a response message returned by the sensor serial port. Then, determine whether the response message is abnormal to confirm whether a sensor serial port fault has occurred. Step 4, Gateway serial port troubleshooting phase: First, use another USB-to-serial converter to establish a test signal connection between the host computer and the gateway's auxiliary test serial port. The serial port on this USB-to-serial converter is called debug serial port II. Then, open the debugging serial port I to establish a communication connection between the debugging serial port I and the serial port to be tested, open the debugging serial port II to establish a communication connection between the debugging serial port II and the auxiliary test serial port, and set the serial port to be tested to write the collected data intact into the auxiliary test serial port; Finally, write byte stream I to debug serial port I, read byte stream II from debug serial port II, and confirm whether a serial port failure to be tested occurs by comparing byte stream I with byte stream II.

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

3. The method for debugging and troubleshooting external serial ports of a gateway machine according to claim 1, characterized in that: The serial port debugging stage includes the following steps: Step 21: Maintain the connection between the debugging serial port and the serial port to be tested, and between the sensor serial port and the serial port to be tested, and open the debugging serial port with the same configuration information as the serial port to be tested; Step 22: Use the gateway as the Modbus master station and periodically send query messages to the sensor serial port through the serial port to be tested, and then go to step 23; Step 23: If the query message cannot be received through the debugging serial port, it is preliminarily determined that the serial port to be tested has a fault; If the query message can be received through the debugging serial port, it indicates that the serial port to be tested sends messages normally, and the process goes to step 24; Step 24: If the debug serial port cannot receive the response message returned by the sensor serial port, it is preliminarily determined that the sensor serial port is faulty; if the debug serial port can receive the response message returned by the sensor serial port, it indicates that the serial port to be tested is receiving messages normally, and the process proceeds to step 25. Step 25: If the gateway machine data display is abnormal, it is preliminarily determined that the serial port to be tested is faulty; If the gateway machine data display is normal, go to step 26; Step 26: Disconnect the debug serial port from the serial port to be tested. If the gateway machine displays abnormal data, it is preliminarily determined that the serial port to be tested has a fault. If the gateway data display is normal and the serial port communication to be tested is normal, the debugging is completed.

4. The method for debugging and troubleshooting external serial ports of a gateway machine according to claim 1, characterized in that: The sensor serial port fault troubleshooting stage includes the following steps: Step 31: Maintain the connection between the debugging serial port and the serial port to be tested, and between the sensor serial port and the serial port to be tested, and open the debugging serial port with the same configuration information as the serial port to be tested; Step 32: Send a query message to the sensor serial port through the debug serial port, and go to step 33; Step 33: If the response message returned by the sensor serial port can be received through the debugging serial port, then go to step 34; If the response message returned by the sensor serial port cannot be received through the debugging serial port, then go to step 35; 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. 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, and return to step 32; if there is no untried baud rate, confirm that the sensor serial port is faulty.

5. The method for debugging and troubleshooting external serial ports of a gateway machine according to claim 1, characterized in that: The gateway serial port troubleshooting phase includes the following steps: Step 41: Maintain the connection between the debugging serial port I and the serial port to be tested, create a new 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: Establish a mapping relationship between the debug serial port I and the debug serial port II, and then bind the mapping relationship between the serial port to be tested and the auxiliary test serial port. Set the serial port to be tested to continuously collect data, and write the collected data intact to the auxiliary test serial port. Step 43: randomly generate a byte sequence stream I and write it to the debugging serial port I. Based on the mapping relationship between the serial port to be tested and the auxiliary test serial port, the serial port to be tested directly writes the collected byte sequence stream to 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 stream II read from the debugging serial port II with the byte stream I written into the debugging serial port I. If the two are consistent, it is confirmed that the communication of the serial port to be tested is normal. If the two contents are inconsistent, it is confirmed that the serial port communication to be tested is abnormal.

6. A serial port debugging module, characterized by: It includes a configuration unit, a message receiving unit, a message generating unit, a message sending unit, an auxiliary debugging unit and a content comparing unit; The configuration unit is used to configure the debug serial port, and the configuration information of the debug serial port includes baud rate, parity bit, data bit and stop bit; The message receiving unit is used to receive message data from the debugging serial port; The message generating unit is used to generate message data and send it to the message sending unit; The message sending unit is used to send message data to the debugging serial port; The auxiliary debugging unit is used to establish a mapping relationship between two debugging serial ports, and the two debugging serial ports are respectively referred to as debugging serial port I and debugging serial port II; Calling the message generating unit to generate message data I, calling the message sending unit to send message data I to the debugging serial port I, calling the message receiving unit to receive message data II from the debugging serial port II, and calling the content comparing unit to store the message data I and the message data II; The content comparison unit is used 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 device for debugging and troubleshooting external serial ports of a gateway machine, characterized by: It includes a host computer and a USB serial conversion tool. The serial port debugging module as described in claim 6 is set in the host computer. A test signal connection is established between the host computer and the external serial port of the gateway machine through the USB serial conversion tool. The serial port on the USB serial conversion tool is called a debugging serial port.

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

  • Serial port communication fault detection device and method

    CN112415936A

  • Gateway machine wired sensor message simulation test method and simulation test device

    CN120358169A

  • Control system for an apparatus of a remote place

    KR1020100138414A