CN115225113A - Communication port matching method, device, communication module and storage medium - Google Patents

Communication port matching method, device, communication module and storage medium Download PDF

Info

Publication number
CN115225113A
CN115225113A CN202210825335.1A CN202210825335A CN115225113A CN 115225113 A CN115225113 A CN 115225113A CN 202210825335 A CN202210825335 A CN 202210825335A CN 115225113 A CN115225113 A CN 115225113A
Authority
CN
China
Prior art keywords
port
communication
communication module
preset
receiving
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
CN202210825335.1A
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.)
Foshan Xingman Information Technology Co Ltd
Original Assignee
Foshan Xingman Information Technology 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 Foshan Xingman Information Technology Co Ltd filed Critical Foshan Xingman Information Technology Co Ltd
Priority to CN202210825335.1A priority Critical patent/CN115225113A/en
Publication of CN115225113A publication Critical patent/CN115225113A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B1/00Details of transmission systems, not covered by a single one of groups H04B3/00 - H04B13/00; Details of transmission systems not characterised by the medium used for transmission
    • H04B1/38Transceivers, i.e. devices in which transmitter and receiver form a structural unit and in which at least one part is used for functions of transmitting and receiving
    • H04B1/40Circuits
    • H04B1/44Transmit/receive switching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/0816Configuration setting characterised by the conditions triggering a change of settings the condition being an adaptation, e.g. in response to network events

Abstract

The application provides a communication port matching method, a communication port matching device, a communication module and a storage medium, and relates to the technical field of communication. The method comprises the following steps: the method comprises the steps of obtaining a data receiving state of a preset receiving port, determining whether port connection relations between two communication modules are matched or not according to the data receiving state, and if the port connection relations are not matched, modifying port definitions of the preset receiving port and a preset sending port to enable the preset receiving port to be changed into a sending port and the preset sending port to be changed into a receiving port. The method and the device can ensure that the connection relation of the communication ports is matched and the communication modules communicate normally.

Description

Communication port matching method, device, communication module and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for matching a communication port, a communication module, and a storage medium.
Background
During the development of products, communication connection is often needed between different communication modules to exchange communication information.
Due to the change of circuit design requirements or the replacement of new and old schemes, the connection sequence of communication cables connected between different communication modules can be changed, so that the communication ports are not matched, and the communication modules cannot normally communicate with each other.
Disclosure of Invention
The present invention provides a method, an apparatus, a communication module and a storage medium for matching communication ports, so as to ensure that the connection relationships of the communication ports are matched and the communication modules communicate with each other normally.
In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
in a first aspect, an embodiment of the present application provides a communication port matching method, which is applied to any communication module in an interface communication system, where the interface communication system includes: two communication modules connected by a communication port, the method comprising:
acquiring a data receiving state of a preset receiving port;
determining whether the port connection relations between the two communication modules are matched or not according to the data receiving state;
and if the port connection relations are not matched, modifying the port definitions of the preset receiving port and the preset sending port, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
Optionally, before the obtaining of the data receiving state of the preset receiving port, the method further includes:
receiving a first port definition instruction for any communication module;
and configuring the first port as the preset receiving port and the second port as the preset sending port according to the first port definition instruction.
Optionally, the determining, according to the data receiving state, whether the port connection relationship between the two communication modules is matched includes:
if the data receiving state is as follows: and determining that the port connection relation is not matched when the preset receiving port does not receive data in a preset period.
Optionally, if the port connection relationship is not matched, modifying the port definitions of the preset receiving port and the preset sending port, so that the preset receiving port becomes a sending port, and the preset sending port becomes a receiving port, including:
if the port connection relations are not matched, outputting first prompt information to indicate that the port connection relations are not matched;
receiving a second port definition instruction for the any communication module;
and modifying the port definitions of the preset receiving port and the preset sending port according to the second port definition instruction, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
Optionally, if the port connection relationship is not matched, outputting a first prompt message, including:
if the port connection relation is not matched, judging whether the port definition of any communication module is modified;
and if the first prompt message is not modified, outputting the first prompt message.
Optionally, if the port connection relationship is not matched, determining whether the port definition of any communication module has been modified includes:
if the port connection relation is not matched, judging whether the port definition of any communication module is modified or not according to the port interchange identification.
Optionally, the method further includes:
and if the communication module is modified, outputting second prompt information to indicate that port communication abnormity exists between the two communication modules.
In a second aspect, an embodiment of the present application provides a communication port matching device, which is applied to any communication module in an interface communication system, where the interface communication system includes: two communication modules ported, the apparatus comprising:
the acquisition module is used for acquiring the data receiving state of a preset receiving port;
the judging module is used for determining whether the port connection relation between the two communication modules is matched or not according to the data receiving state;
and the processing module is used for modifying the port definitions of the preset receiving port and the preset sending port if the port connection relations are not matched, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
Optionally, the apparatus further comprises:
a receiving module, configured to receive a first port definition instruction for any one of the communication modules;
and the configuration module is used for configuring the first port as the preset receiving port and configuring the second port as the preset sending port according to the first port definition instruction.
Optionally, the determining module is specifically configured to, if the data receiving status is: and determining that the port connection relation is not matched when the preset receiving port does not receive data in a preset period.
Optionally, the processing module includes: an output unit and a processing unit;
the output unit is used for outputting first prompt information to indicate that the port connection relations are not matched if the port connection relations are not matched;
the receiving module is further configured to receive a second port definition instruction for any communication module;
and the processing unit modifies the port definitions of the preset receiving port and the preset sending port according to the second port definition instruction, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
Optionally, the determining module is further configured to determine whether the port definition of any communication module has been modified if the port connection relationship is not matched;
the output unit is specifically configured to output the first prompt information if the first prompt information is not modified.
Optionally, the determining module is specifically configured to determine, if the port connection relationship is not matched, whether the port definition of any of the communication modules has been modified according to the port interchange identifier.
Optionally, the output unit is further configured to output a second prompt message if the modification has been made, so as to indicate that port communication abnormality exists between the two communication modules.
In a third aspect, an embodiment of the present application further provides a communication module, including: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, when the communication module runs, the processor and the storage medium communicate with each other through the bus, and the processor executes the program instructions to execute the steps of the communication port matching method according to any one of the first aspect.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where the storage medium stores a computer program, and the computer program is executed by a processor to perform the steps of the communication port matching method according to any one of the first aspect.
The beneficial effect of this application is:
the application provides a communication port matching method, a device, a communication module and a storage medium, wherein the method is applied to any communication module in an interface communication system, and the interface communication system comprises: two communication modules connected by a communication port, the method comprising: the method comprises the steps of obtaining a data receiving state of a preset receiving port, determining whether port connection relations between two communication modules are matched or not according to the data receiving state, and modifying port definitions of the preset receiving port and a preset sending port if the port connection relations are not matched, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port. According to the method and the device, whether the port connection relation between the two communication modules is matched is judged according to the data receiving state of the preset receiving port, the port definitions of the preset receiving port and the preset sending port are modified under the unmatched condition, the preset receiving port is changed into the sending port, the preset sending port is changed into the receiving port, the port connection relation between the two communication modules is matched, and normal communication between the two communication modules is guaranteed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic structural diagram of an interface communication system according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a communication port matching method according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of another communication port matching method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another communication port matching method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of another communication port matching method according to an embodiment of the present application;
fig. 6 is a schematic full-flow diagram of a communication port matching method according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a communication port matching apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic diagram of a communication module according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. 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.
Furthermore, the terms "first," "second," and the like in the description and in the claims, as well as in the drawings, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
The communication port matching method provided by the embodiment of the application is applied to any communication module in an interface communication system. Referring to fig. 1, a schematic structural diagram of an interface communication system according to an embodiment of the present application is shown in fig. 1, where the interface communication system includes: and the communication module A and the communication module B are connected through the communication ports.
Specifically, the communication module a includes two communication ports, one of which is defined as a receiving port RX1 and the other is defined as a transmitting port TX1, and the communication module B also includes two communication ports, one of which is defined as a receiving port RX2 and the other is defined as a transmitting port TX2.
In a normal communication state, the receiving port RX1 of the communication module a is connected to the transmitting port TX2 of the communication module B, the transmitting port TX1 of the communication module a is connected to the receiving port RX2 of the communication module B, one end of the first resistor R1 and one end of the second resistor R2 are connected to the power supply VCC, the other end of the first resistor R1 is connected to the receiving port RX1 of the communication module a, and the other end of the second resistor R2 is connected to the receiving port RX2 of the communication module B.
When the communication module a sends a high level signal to the receiving port RX2 of the communication module B through the sending port TX1, the voltage of the receiving port RX2 of the communication module B is pulled high by the power supply VCC through the second resistor R2, and the receiving port RX2 of the communication module B receives the high level signal, thereby completing the communication between the communication module a and the communication module B.
When the communication module B sends a high level signal to the receiving port RX1 of the communication module a through the sending port TX2, the voltage of the receiving port RX1 of the communication module a is pulled high by the power supply VCC through the first resistor R1, and the receiving port RX1 of the communication module a receives the high level signal, thereby completing the communication between the communication module a and the communication module B.
The above procedure is that when the transmission port TX1 of the communication module a is connected to the reception port RX2 of the communication module B, and the transmission port TX2 of the communication module B is connected to the reception port RX1 of the communication module a, the communication module a and the communication module B communicate normally. However, in the actual product design process, due to the change of circuit design requirements or the replacement of design schemes, the definitions of the communication ports of the communication module a and the communication module B may be changed, so that the port connections are no longer matched, and the communication module a and the communication module B cannot communicate normally.
Based on this, embodiments of the present application provide a communication port matching method, apparatus, communication module, and storage medium, which can determine whether a port connection relationship between two communication modules is matched, and in case of no match, modify a port definition to match the port connection relationship, thereby ensuring normal communication between the two communication modules.
It should be noted that, the communication module a and the communication module B in the interface communication system according to the embodiment of the present application may be communication modules on the circuit module a and the circuit module B that need to perform communication, or communication modules on the electronic device a and the electronic device B that need to perform communication, respectively, which is not limited in this application.
Hereinafter, a communication port matching method, a communication port matching device, a communication module, and a storage medium according to embodiments of the present application will be described in detail by taking a communication module a in an interface communication system as an example. It should be noted that the following process with the communication module a as the execution subject may also be completed with the communication module B as the execution subject, which is not limited in the embodiment of the present application.
Referring to fig. 2, a schematic flow chart of a communication port matching method according to an embodiment of the present invention is shown, and as shown in fig. 2, the method includes:
s20: and acquiring the data receiving state of the preset receiving port.
In this embodiment, taking the port communication system shown in fig. 1 as an example, two communication ports of a communication module a are communicatively connected with two communication ports of a communication module B, after the communication module a and the communication module B are powered on and initialized, the two communication ports of the communication module a are defined in advance by a Micro Control Unit (MCU) of the communication module a, it is determined that one communication port of the communication module a is a preset receiving port, the other communication port of the communication module a is a preset transmitting port, the two communication ports of the communication module B are defined in advance by a MCU of the communication module B, it is determined that one communication port of the communication module B is a receiving port, and the other communication port of the communication module B is a transmitting port.
The data receiving method includes the steps that data are sent to a communication module A through a sending port of the communication module B, a Micro Control Unit (MCU) in the communication module A detects a preset receiving port to obtain a data receiving state of the preset receiving port, and the data receiving state is used for indicating the data receiving condition of the preset receiving port.
S30: and determining whether the port connection relations between the two communication modules are matched or not according to the data receiving state.
In this embodiment, the micro control unit of the communication module a determines whether the data receiving state of the preset receiving port of the communication module a satisfies the preset receiving rule according to the predefined data receiving rule, and determines that the port connection relationship between the communication module a and the communication module B is not matched if the data receiving state does not satisfy the preset receiving rule. The port connection relation mismatch is that a preset receiving port of the communication module A is connected with a receiving port of the communication module B, and a preset sending port of the communication module A is connected with a sending port of the communication module B; correspondingly, the port connection relationship is matched in that a preset receiving port of the communication module a is connected with a sending port of the communication module B, and a preset sending port of the communication module a is connected with an interface port of the communication module B.
In an optional embodiment, the determining whether the port connection relationship between the two communication modules matches according to the data receiving status in S30 may include:
if the data receiving state is: and in a preset period, presetting that the receiving port does not receive data, and determining that the port connection relation is not matched.
In this embodiment, the data receiving rule may be a rule that the preset receiving port receives data in a preset period, and if the data receiving state does not satisfy the preset receiving rule, that is, the preset receiving port of the communication module a does not receive the data sent by the sending port of the communication module B in the preset period, it is determined that the port connection relationship between the communication module a and the communication module B is not matched.
For example, as shown in fig. 1, when the communication module B sends a signal to the communication module a through the sending port, if the port connection relationships of the communication module a and the communication module B are matched, the voltage of the preset receiving port of the communication module a is pulled high by the power VCC through the first resistor R1, the preset receiving port of the communication module a receives a high-level signal, and the communication module a and the communication module B can normally communicate; and if the preset receiving port of the communication module A does not receive the high-level signal in the preset period, determining that the port connection relation between the communication module A and the communication module B is not matched.
S40: if the port connection relations are not matched, modifying the port definitions of the preset receiving port and the preset sending port, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
In this embodiment, when it is determined that the port connection relationship is not matched, the port connection relationship between the communication module a and the communication module B needs to be modified again, so that the preset receiving port of the communication module a is connected to the sending port of the communication module B, and the preset sending port of the communication module a is connected to the receiving port of the communication module B. Specifically, the manner of modifying the port connection relationship between the communication module a and the communication module B may be: and modifying the port definition of the communication module A to change the preset receiving port into a sending port for sending data and change the preset sending port into a receiving port for receiving data.
After port definitions of a preset receiving port and a preset sending port are modified, data are sent to the communication module A again through the sending port of the communication module B, a micro control unit in the communication module A detects the modified receiving port to obtain a data receiving state of the modified receiving port, whether the data receiving state meets a preset receiving rule or not is judged, if the data receiving state meets the preset receiving rule, port connection relations of the communication module A and the communication module B are determined to be matched, and normal communication can be achieved between the communication module A and the communication module B; if the data receiving state does not meet the preset receiving rule, the port connection relation between the communication module A and the communication module B is modified, so that the condition of port connection relation error is eliminated, and the communication fault between the ports of the communication module A and the communication module B is determined.
In the communication port matching method provided in the above embodiment, whether the port connection relationship between the two communication modules is matched is determined according to the data receiving state of the preset receiving port, and under the condition that the port connection relationship is not matched, the port definitions of the preset receiving port and the preset sending port are modified, the preset receiving port is changed into the sending port, the preset sending port is changed into the receiving port, so that the port connection relationship between the two communication modules is matched, and normal communication between the two communication modules is ensured.
On the basis of the above embodiments, the embodiments of the present application further provide another communication port matching method. Referring to fig. 3, a schematic flow chart of another communication port matching method according to an embodiment of the present application is shown in fig. 3, where before the step S20 obtains a data receiving status of a preset receiving port, the method may further include:
s11: a first port definition instruction for any communication module is received.
In this embodiment, the communication port of the communication module has a self-defined function, and a developer may send a first port definition instruction to the micro control unit of the communication module, where the first port definition instruction is used to define one port of the communication module as a receiving port and define another port of the communication module as a sending port.
S12: and configuring the first port as a preset receiving port and the second port as a preset sending port according to the first port definition instruction.
In this embodiment, the micro control unit configures the first port as a preset receiving port and configures the second port as a preset sending port according to the definition instructions of the two ports of the communication module in the received first port definition instructions, so that the first port is used for receiving data and the second port is used for sending data.
Further, after the port definitions of the communication module a and the communication module B are completed by using the above S11 to S12, the micro control unit of the communication module a or the micro control unit of the communication module a executes the above processes of S20 to S40, so as to match the communication ports between the communication module a and the communication module B.
According to the communication port matching method provided by the embodiment, the first port and the second port of the communication module are defined through the first port definition instruction, and the ports can be customized through the instruction, so that flexible setting of data receiving and data sending of the ports is realized, and the flexibility of circuit design is improved.
On the basis of the above embodiments, the embodiments of the present application further provide another communication port matching method. Referring to fig. 4, a schematic flow chart of another communication port matching method according to an embodiment of the present invention is shown in fig. 4, where as shown in fig. 4, if the port connection relationships are not matched in S40, modifying the port definitions of the preset receiving port and the preset sending port so that the preset receiving port becomes a sending port and the preset sending port becomes a receiving port, may include:
s41: and if the port connection relations are not matched, outputting first prompt information to indicate that the port connection relations are not matched.
In this embodiment, if the micro control unit of the communication module a determines that the port connection relationships of the communication module a and the communication module B are not matched according to the data receiving state, the micro control unit of the communication module a outputs first prompt information, where the first prompt information is used to indicate that the port connection relationships of the communication module a and the communication module B are not matched.
For example, the way for the micro control unit of the communication module a to output the first prompt information may be: a communication fault display unit is arranged on the communication module A, and the first prompt message can be a prompt message for controlling the communication fault display unit to emit light in a first light emitting mode by the micro control unit; the mode of the micro control unit of the communication module a outputting the first prompt information may also be: the micro control unit of the communication module A is connected with the computer device to output a first communication fault code to the computer device, wherein the first communication fault code is used for indicating that the port connection relation of the communication module A and the communication module B is not matched.
S42: a second port definition instruction for any of the communication modules is received.
In this embodiment, the second port definition instruction is used to modify the definitions of two ports of the communication module, modify the first port from a preset receiving port to a sending port, and modify the second port from a preset sending port to a receiving port. For example, the method for obtaining the second port definition instruction may be: after receiving the first prompt message, the research and development personnel send a second port definition instruction to a micro control unit of the communication module; the method can also comprise the following steps: the micro control unit of the communication module a directly triggers and generates the second port definition instruction based on the first prompt information, which is not limited in this application.
S43: and modifying the port definitions of the preset receiving port and the preset sending port according to the second port definition instruction, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
In this embodiment, according to the received definition instruction of the second port definition instruction on the two ports of the communication module, the micro control unit of the communication module modifies the first port from the preset receiving port to the sending port, and modifies the second port from the preset sending port to the receiving port.
It should be noted that the first port definition instruction needs to be sent to the communication module a and the communication module B to define both the two communication ports of the communication module a and the two communication ports of the communication module B, but when modifying the port definition according to the second port definition instruction, only the second port definition instruction needs to be sent to the communication module a or the communication module B, and only the port definition of one of the communication modules is modified. For example, because the mismatch of the port connection relationship means that the preset sending port of the communication module a is connected with the sending port of the communication module B, and the preset receiving port of the communication module a is connected with the receiving port of the communication module B, a developer may select to send the second port definition instruction to the micro control unit of the communication module a, or send the second port definition instruction to the micro control unit of the communication module B, but may not send the second port definition instruction to both the micro control unit of the communication module a and the micro control unit of the communication module B.
In the communication port matching method provided in the above embodiment, the port definitions of the first port and the second port of the communication module are modified through the second port definition instruction, so that it is ensured that when the port connection relationships are not matched, the port connection manner can be directly modified through the port definition instruction without manually modifying the connection relationship between the first port and the second port, on one hand, the efficiency of modifying the port connection manner is improved, on the other hand, the plugging/unplugging times of the first port and the second port are reduced, and the service life of the port is prolonged.
On the basis of the above embodiments, the embodiments of the present application further provide another communication port matching method. Referring to fig. 5, a schematic flow chart of another communication port matching method according to an embodiment of the present invention is shown in fig. 5, where as shown in fig. 5, if the port connection relationships are not matched in the above step S41, outputting the first prompt information may include:
s411: if the port connection relations are not matched, whether the port definition of any communication module is modified or not is judged.
In this embodiment, if the micro control unit of the communication module a determines that the port connection relationships of the communication module a and the communication module B are not matched according to the data receiving state, before outputting the first prompt information so that the research and development staff inputs the second port definition instruction according to the first prompt information, it is necessary to determine whether the port definition of the communication module a has been modified, that is, determine whether the first port definition instruction is an instruction for modifying the port definition of the communication module a.
In an optional embodiment, if the port connection relationship is not matched in the step S411, the determining whether the port definition of any communication module has been modified may include:
if the port connection relation is not matched, whether the port definition of any communication module is modified or not is judged according to the port interchange identification.
In this embodiment, the port interchange identifier is used to indicate whether the port definition of the communication module has been modified, where the port interchange identifier is a first preset value and is used to indicate that the port definition of the communication module has not been modified; and if the port interchange identifier is a second preset value, the port interchange identifier is used for indicating that the port definition of the communication module is modified. Illustratively, the first preset is 0 and the second preset is 1.
In the case that the port connection relationship is determined not to match, the micro control unit of the communication module a may determine whether the port definition of the communication module a has been modified according to the port interchange identifier. Specifically, the initial value of the port interchange identifier is a first preset value, and if the micro control unit of the communication module a receives a port definition instruction for the first time, that is, the first port definition instruction, the port interchange identifier maintains the first preset value; when the micro control unit of the communication module a receives the port definition instruction for the second time, that is, the second port definition instruction, the port interchange identifier is switched from the first preset to the first preset.
S412: and if the first prompt message is not modified, outputting the first prompt message.
In this embodiment, if the port interchange identifier is the first preset, and indicates that the port definition of the communication module a is not modified, the first prompt information is output, so that a developer sends a second port definition instruction to the micro control unit of the communication module a based on the first prompt information to modify the port definition of the communication module a, and the port interchange identifier is switched from the first preset to the second preset.
In an alternative embodiment, the method further comprises:
and if the communication module is modified, outputting second prompt information to indicate that port communication abnormity exists between the two communication modules.
In this embodiment, if the port interchange identifier is the second preset, and indicates that the port definition of the communication module a has been modified, the second prompt information is output, so that a developer determines that the port communication abnormality exists between the communication module a and the communication module B based on the second prompt information.
For example, the way for the micro control unit of the communication module a to output the second prompt message may be: the micro control unit of the communication module A controls the communication fault display unit to emit light in a second light emitting mode to give prompt information; the way for the micro control unit of the communication module a to output the second prompt information may also be: the micro control unit of the communication module A is connected with the computer equipment so as to output a second communication fault code to the computer equipment, and the second communication fault code is used for indicating that the port communication of the communication module A and the port communication of the communication module B are abnormal.
In the communication port matching method provided in the foregoing embodiment, when the port connection relationship is not matched, it is determined whether the port definition of the communication module has been modified, and if not, the first prompt message is sent to receive the second port definition instruction based on the first prompt message, and if so, the second prompt message is sent to indicate that there is port communication abnormality between the two communication modules, so as to avoid time waste in continuously sending the second state modification instruction when the port connection relationship is determined to be not matched, and improve the efficiency of testing whether the communication port connection relationship is matched.
Referring to fig. 6, a schematic diagram of a full flow chart of a communication port matching method according to an embodiment of the present application is shown in fig. 6, where the method includes:
s101: and powering on for initialization, and starting to send data.
Specifically, after the communication module a and the communication module B are powered on and initialized, data is sent to the communication module a through the sending port of the communication module B.
S102: and reading the data receiving state of the receiving port.
Specifically, the micro control unit of the communication module a reads the data receiving state of the preset receiving port of the communication module a.
S103: and judging whether the time count is greater than or equal to a preset judging period.
Specifically, the micro control unit of the communication module a starts timing when starting to read the data receiving state, and stops reading the data receiving state when the time count is greater than or equal to the determination period.
S104: and checking whether the data receiving state is correct.
Specifically, whether the data receiving state meets a preset receiving rule is judged.
S105: and if the data receiving state is correct, entering a normal communication module.
Specifically, if the data receiving state meets the preset receiving rule, the port connection relationship between the communication module a and the communication module B is matched, and the normal communication module is started between the communication module a and the communication module B.
S106: whether the port interchange identification bcommexchange is 1 is judged.
Specifically, 0 is a first preset value of the port interchange identifier bcommexchange, which is used to indicate that the port definition of the communication module a is not modified, and 1 is a second preset value of the port interchange identifier bcommexchange, which is used to indicate that the port definition of the communication module a is modified.
S107: if the port interchange identification bComExchange is 1, error communication is abnormal.
Specifically, if the port interchange identifier bcommexchange is 1, it is determined that the port definition of the communication module a has been modified, and in this case, the data receiving state still does not satisfy the preset receiving rule, it is determined that there is a communication abnormality between the communication module a and the communication module B.
S108: and if the port interchange identification bComExchange is 0, interchanging the preset sending port and the preset receiving port.
If the port interchange identifier bcommexchange is 0, determining that the port definition of the communication module a is not modified, in this case, receiving a second port definition instruction, modifying the preset sending port to be a receiving port and modifying the preset receiving port to be a sending port according to the second port definition instruction.
S109: setting the value of the port interchange identification bComExchange to 1, executing S102-S107 again, and judging whether the communication module A and the communication module B enter a normal communication mode or report an error communication exception.
On the basis of the above embodiments, the embodiments of the present application further provide a communication port matching device. Referring to fig. 7, a schematic structural diagram of a communication port matching device according to an embodiment of the present application is shown in fig. 7, where the device includes:
an obtaining module 10, configured to obtain a data receiving state of a preset receiving port;
the judging module 20 is configured to determine whether the port connection relationships between the two communication modules are matched according to the data receiving state;
the processing module 30 is configured to modify the port definitions of the preset receiving port and the preset sending port if the port connection relationships are not matched, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
Optionally, the apparatus further comprises:
the receiving module is used for receiving a first port definition instruction aiming at any communication module;
and the configuration module is used for configuring the first port as a preset receiving port and the second port as a preset sending port according to the first port definition instruction.
Optionally, the determining module 20 is specifically configured to, if the data receiving status is: and in a preset period, presetting that the receiving port does not receive data, and determining that the port connection relation is not matched.
Optionally, the processing module 30 includes: an output unit and a processing unit;
the output unit is used for outputting first prompt information to indicate that the port connection relations are not matched if the port connection relations are not matched;
the receiving module is also used for receiving a second port definition instruction aiming at any communication module;
and the processing unit modifies the port definitions of the preset receiving port and the preset sending port according to the second port definition instruction, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
Optionally, the determining module 20 is further configured to determine whether the port definition of any communication module has been modified if the port connection relationships are not matched;
and the output unit is specifically used for outputting the first prompt message if the first prompt message is not modified.
Optionally, the determining module 20 is specifically configured to determine whether the port definition of any communication module has been modified according to the port interchange identifier if the port connection relationships are not matched.
Optionally, the output unit is further configured to output a second prompt message if the modification has been made, so as to indicate that port communication abnormality exists between the two communication modules.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Referring to fig. 8, a schematic diagram of a communication module according to an embodiment of the present application is shown in fig. 8, where the communication module 100 includes: a processor 101, a storage medium 102, and a bus.
The storage medium 102 stores program instructions executable by the processor 101, and when the communication module 100 runs, the processor 101 and the storage medium 102 communicate with each other through a bus, and the processor 101 executes the program instructions to execute the above method embodiments. The specific implementation and technical effects are similar, and are not described herein again.
Optionally, the present invention also provides a program product, such as a computer-readable storage medium, having a computer program stored thereon, which, when executed by a processor, is adapted to perform the above-described method embodiments.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and shall be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A communication port matching method is applied to any communication module in an interface communication system, and the interface communication system comprises: two communication modules connected by a communication port, the method comprising:
acquiring a data receiving state of a preset receiving port;
determining whether the port connection relation between the two communication modules is matched or not according to the data receiving state;
if the port connection relations are not matched, modifying the port definitions of the preset receiving port and the preset sending port, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
2. The method of claim 1, wherein before obtaining the data receiving status of the predetermined receiving port, the method further comprises:
receiving a first port definition instruction for any communication module;
and configuring the first port as the preset receiving port and the second port as the preset sending port according to the first port definition instruction.
3. The method of claim 1, wherein said determining whether the port connection relationship between the two communication modules matches based on the data reception status comprises:
if the data receiving state is: and determining that the port connection relation is not matched when the preset receiving port does not receive data in a preset period.
4. The method of claim 1, wherein if the port connection relationships do not match, modifying the port definitions of the predetermined receiving port and the predetermined transmitting port such that the predetermined receiving port becomes the transmitting port and the predetermined transmitting port becomes the receiving port comprises:
if the port connection relations are not matched, outputting first prompt information to indicate that the port connection relations are not matched;
receiving a second port definition instruction for any communication module;
and modifying the port definitions of the preset receiving port and the preset sending port according to the second port definition instruction, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
5. The method of claim 4, wherein outputting a first hint message if the port connectivity relationship does not match comprises:
if the port connection relation is not matched, judging whether the port definition of any communication module is modified;
and if the first prompt message is not modified, outputting the first prompt message.
6. The method according to claim 5, wherein said determining whether the port definition of any of the communication modules has been modified if the port connection relationship does not match comprises:
and if the port connection relation is not matched, judging whether the port definition of any communication module is modified or not according to the port interchange identification.
7. The method of claim 5, wherein the method further comprises:
and if the communication module is modified, outputting second prompt information to indicate that port communication abnormity exists between the two communication modules.
8. A communication port matching apparatus, applied to any communication module in an interface communication system, the interface communication system comprising: two communication modules ported, the apparatus comprising:
the acquisition module is used for acquiring the data receiving state of a preset receiving port;
the judging module is used for determining whether the port connection relation between the two communication modules is matched or not according to the data receiving state;
and the processing module is used for modifying the port definitions of the preset receiving port and the preset sending port if the port connection relations are not matched, so that the preset receiving port is changed into a sending port, and the preset sending port is changed into a receiving port.
9. A communication module, comprising: a processor, a storage medium and a bus, the storage medium storing program instructions executable by the processor, the processor and the storage medium communicating via the bus when the communication module is running, the processor executing the program instructions to perform the steps of the communication port matching method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the communication port matching method according to one of claims 1 to 7.
CN202210825335.1A 2022-07-13 2022-07-13 Communication port matching method, device, communication module and storage medium Pending CN115225113A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210825335.1A CN115225113A (en) 2022-07-13 2022-07-13 Communication port matching method, device, communication module and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210825335.1A CN115225113A (en) 2022-07-13 2022-07-13 Communication port matching method, device, communication module and storage medium

Publications (1)

Publication Number Publication Date
CN115225113A true CN115225113A (en) 2022-10-21

Family

ID=83611246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210825335.1A Pending CN115225113A (en) 2022-07-13 2022-07-13 Communication port matching method, device, communication module and storage medium

Country Status (1)

Country Link
CN (1) CN115225113A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050165970A1 (en) * 2004-01-28 2005-07-28 Michael Ching Adaptive-allocation of I/O bandwidth using a configurable interconnect topology
CN1753331A (en) * 2004-09-24 2006-03-29 华为技术有限公司 Method of proceeding resynchronization of interface link
WO2014110707A1 (en) * 2013-01-15 2014-07-24 华为技术有限公司 Method, device, and system for detecting interconnection error
US20140280791A1 (en) * 2013-03-15 2014-09-18 International Business Machines Corporation Dynamic port type detection
WO2021115284A1 (en) * 2019-12-10 2021-06-17 中兴通讯股份有限公司 Device protocol interconnection method and device, and storage medium
WO2022002168A1 (en) * 2020-06-30 2022-01-06 华为技术有限公司 Chip module and communication system, and port allocation method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050165970A1 (en) * 2004-01-28 2005-07-28 Michael Ching Adaptive-allocation of I/O bandwidth using a configurable interconnect topology
CN1753331A (en) * 2004-09-24 2006-03-29 华为技术有限公司 Method of proceeding resynchronization of interface link
WO2014110707A1 (en) * 2013-01-15 2014-07-24 华为技术有限公司 Method, device, and system for detecting interconnection error
US20140280791A1 (en) * 2013-03-15 2014-09-18 International Business Machines Corporation Dynamic port type detection
WO2021115284A1 (en) * 2019-12-10 2021-06-17 中兴通讯股份有限公司 Device protocol interconnection method and device, and storage medium
WO2022002168A1 (en) * 2020-06-30 2022-01-06 华为技术有限公司 Chip module and communication system, and port allocation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
我可不是花生: "串口接收无数据或接收数据错乱", Retrieved from the Internet <URL:https://jingyan.baidu.com/article/86fae34691ea467d49121ab5.html> *

Similar Documents

Publication Publication Date Title
US9158723B2 (en) Expanded protocol adapter for in-vehicle networks
US8397053B2 (en) Multi-motherboard server system
US20080294065A1 (en) Multiple configuration electronic thermometer
CN114003538B (en) Identification method of intelligent network card and intelligent network card
JP2007102764A (en) Remote terminal device of programmable controller
CN116107819A (en) Server start-up fault detection system, method, device and medium
CN110658758A (en) Control method and control system
CN105653306A (en) Method and device for displaying start Setup interface
CN114168395A (en) Chip power-on control method, control device and storage medium
CN115225113A (en) Communication port matching method, device, communication module and storage medium
CN114356060B (en) Master-slave exchange type power supply device, power supply method and host
CN212782723U (en) PCIe and SATA compatible copying device
CN113726543B (en) Operation and maintenance service processing method, device, system, server and storage medium
JP4841163B2 (en) Security terminal
JP4400726B2 (en) Sensor device
JP6036229B2 (en) Battery control device, battery control method, and program
CN114253781A (en) Test method, device, equipment and storage medium
CN101930381A (en) Debugging system of server
WO2020129324A1 (en) Module, information processing device equipped with same, and program data updating method for updating program data of module
CN108075910B (en) Configuration method of communication equipment and communication equipment
CN113407470B (en) Method, device and equipment for multiplexing low pin count interface and universal asynchronous receiver-transmitter interface
CN115599191B (en) Power-on method and power-on device of intelligent network card
CN114443446B (en) Hard disk indicator lamp control method, system, terminal and storage medium
CN111538627A (en) Method, device, system and storage medium for detecting BIOS fault
CN115499316A (en) Code writer, data transmission method and system

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