CN112822069A - Communication method, device, equipment, system and storage medium - Google Patents

Communication method, device, equipment, system and storage medium Download PDF

Info

Publication number
CN112822069A
CN112822069A CN202011630481.6A CN202011630481A CN112822069A CN 112822069 A CN112822069 A CN 112822069A CN 202011630481 A CN202011630481 A CN 202011630481A CN 112822069 A CN112822069 A CN 112822069A
Authority
CN
China
Prior art keywords
delay time
communication
initial
test
abnormal
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.)
Withdrawn
Application number
CN202011630481.6A
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.)
Guangdong Dapu Telecom Technology Co Ltd
Original Assignee
Guangdong Dapu Telecom 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 Guangdong Dapu Telecom Technology Co Ltd filed Critical Guangdong Dapu Telecom Technology Co Ltd
Priority to CN202011630481.6A priority Critical patent/CN112822069A/en
Publication of CN112822069A publication Critical patent/CN112822069A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0852Delays

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a communication method, a communication device, communication equipment, a communication system and a storage medium. The communication method comprises the following steps: determining initial delay time according to the baud rate of the communication equipment, and communicating with the test equipment according to the initial delay time to obtain a communication result; adjusting the initial delay time until the communication is normal when the communication result shows that the communication is abnormal to obtain first delay time; adjusting the first delay time until the communication is abnormal to obtain a second delay time; and determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time. That is, in the embodiment of the present invention, the theoretical delay time is not directly used for communication, but an actual communication delay time (i.e., a target delay time) is obtained through communication test measurement, and the actual communication delay time is used for communication, so that the communication success rate can be improved.

Description

Communication method, device, equipment, system and storage medium
Technical Field
Embodiments of the present invention relate to the field of data communication technologies, and in particular, to a communication method, apparatus, device, system, and storage medium.
Background
Serial communication is a common communication mode in embedded systems because of low cost and easy implementation. The serial communication is widely applied, and at present, the serial communication is mainly realized by two modes, one mode adopts a standard two-wire mode, namely a receiving wire and a sending wire; the other is a single-wire communication mode, and the same wire is used for receiving and transmitting. At present, the communication delay time adopted in the single-wire communication mode is directly theoretical delay time, is not accurate enough and is easy to cause communication failure.
Disclosure of Invention
Embodiments of the present invention provide a communication method, apparatus, device, system, and storage medium, which can improve a success rate of communication.
In a first aspect, an embodiment of the present invention provides a communication method, including:
determining initial delay time according to the baud rate of the communication equipment, and communicating with the test equipment according to the initial delay time to obtain a communication result;
when the communication result shows that the communication is abnormal, adjusting the initial delay time until the communication is normal to obtain first delay time;
adjusting the first delay time until communication is abnormal to obtain a second delay time;
and determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time.
Further, the determining the initial delay time according to the baud rate of the communication device includes:
determining theoretical delay time according to the baud rate;
and determining the initial delay time according to the theoretical delay time.
Further, the determining the initial delay time according to the theoretical delay time includes:
and reducing the theoretical delay time to obtain the initial delay time.
Further, adjusting the initial delay time until the communication is normal, to obtain a first delay time, includes:
and increasing the initial delay time until the communication is normal to obtain the first delay time.
Further, adjusting the first delay time until communication is abnormal to obtain a second delay time, including:
and increasing the first delay time until communication is abnormal to obtain the second delay time.
Further, the communicating with the testing device according to the initial delay time to obtain a communication result includes:
receiving test data sent by the test equipment according to the initial delay time;
and comparing the test data with preset data, obtaining a communication result indicating normal communication when the test data is the same as the preset data, and obtaining a communication result indicating abnormal communication when the test data is different from the preset data.
Further, the determining a target delay time for communicating with the test device according to the first delay time and the second delay time includes:
and calculating the average value of the first delay time and the second delay time, and taking the average value as the target delay time.
In a second aspect, an embodiment of the present invention further provides a communication apparatus, including:
the communication module is used for determining initial delay time according to the baud rate of the communication equipment and communicating with the test equipment according to the initial delay time to obtain a communication result;
the first adjusting module is used for adjusting the initial delay time until the communication is normal when the communication result shows that the communication is abnormal, so as to obtain first delay time;
the second adjusting module is used for adjusting the first delay time until the communication is abnormal to obtain second delay time;
and the determining module is used for determining the target delay time communicated with the test equipment according to the first delay time and the second delay time.
In a third aspect, an embodiment of the present invention further provides a communication device, where the communication device includes:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the steps of the communication method as in any of the embodiments of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a communication system, including a test device and a communication device for executing the communication method according to any one of the embodiments of the present invention.
In a fifth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the communication method according to any one of the embodiments of the present invention.
The embodiment of the invention determines the initial delay time according to the baud rate of the communication equipment, and communicates with the test equipment according to the initial delay time to obtain a communication result; when the communication result shows that the communication is abnormal, adjusting the initial delay time until the communication is normal to obtain a first delay time; adjusting the first delay time until the communication is abnormal to obtain a second delay time; and determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time. That is, in the embodiment of the present invention, the theoretical delay time is not directly used for communication, but an actual communication delay time (i.e., a target delay time) is obtained through communication test measurement, and the actual communication delay time is used for communication, so that the communication success rate can be improved.
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 flowchart of a communication method according to an embodiment of the present invention;
fig. 2 is a flowchart of a communication method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a communication method according to a third embodiment of the present invention;
fig. 4 is a flowchart of another communication method provided in the third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a communication device according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a communication device according to a fifth embodiment of the present invention;
fig. 7 is a schematic structural diagram of a communication system according to a sixth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Example one
Fig. 1 is a flowchart of a communication method provided in an embodiment of the present invention, where the present embodiment is applicable to a case of single-wire serial port adaptive communication, and the method may be executed by a communication device in an embodiment of the present invention, where the device may be implemented in a software and/or hardware manner, and in a specific embodiment, the device may be integrated in a communication device, and the communication device may be a Microcontroller Unit (MCU). The following embodiments will be described by taking as an example that the apparatus is integrated in a communication device, as shown in fig. 1, the method specifically includes the following steps:
s110, determining initial delay time according to the baud rate of the communication equipment, and communicating with the testing equipment according to the initial delay time to obtain a communication result.
The communication device may be an MCU or other device with single-wire serial communication function. The delay time refers to the time the communication device is used to receive data during a communication. The initial delay time refers to a theoretical time for receiving data determined according to the baud rate of the communication device at the start of communication. The test equipment can be a computer or other equipment with the function of transmitting and receiving data. The present embodiment is only illustrated by taking the communication device and the testing device as an example, and is not limited. The communication result refers to a result of whether data transmission between the test device and the communication device is successful.
Specifically, the baud rate of the communication device may be calculated and determined according to the internal oscillation frequency of the communication device, and the delay time of the communication device may be calculated after the baud rate is determined. The delay time of a communication device is theoretically one-half of the baud rate. That is, if the Baud rate of the communication device is 9600Baud, the theoretically calculated delay time is 1/9600 sec, 104 μ sec. And adjusting the theoretical delay time obtained by calculation, and communicating with the test equipment by taking the adjusted delay time as the initial delay time. In this embodiment, the theoretical delay time may be adjusted by taking 0.5 to 0.6 times the theoretical delay time as the initial delay time.
Further, the test equipment sends data to the communication equipment based on the initial delay time, if the data received by the communication equipment is consistent with the data sent by the test equipment, the communication result is normal, and if the data received by the communication equipment is inconsistent with the data sent by the test equipment, the communication result is abnormal.
The example is given by taking the communication device as an MCU and the test device as a computer. The oscillation frequency of different MCUs is different, the internal oscillation frequency of the MCU is determined according to the known parameters of the MCU, and the baud rate has different calculation methods according to different working modes of serial ports of the MCU. In this embodiment, the working mode 0 of the serial port of the MCU is selected, so the baud rate is a fixed baud rate obtained by dividing the oscillation frequency by 12. If the Baud rate of the MCU is determined to be 9600Baud through calculation, the delay time obtained through theoretical calculation is 104 microseconds. Taking 0.5 times of the administrative delay time as the initial delay time, the initial delay time for the communication between the MCU and the computer is 52 microseconds. Based on the initial delay time of 52 microseconds, the computer sends data 0xaa to the MCU, and if the data received by the MCU is 0xaa, the communication between the MCU and the computer is normal.
It should be noted that, in the present embodiment, the initial delay time for communication is only 0.5 to 0.6 times the delay time theoretically calculated, and therefore, based on the initial delay time, the communication result between the MCU and the computer is necessarily a communication abnormality. That is, the communication result obtained in this step is a communication abnormality.
And S120, when the communication result shows that the communication is abnormal, adjusting the initial delay time until the communication is normal to obtain a first delay time.
Wherein, the communication abnormity refers to data transmission failure between the communication equipment and the test equipment. It will be appreciated that the data received by the communication device is not consistent with the data sent by the test device. The normal communication means that data transmission between the communication device and the test device is successful. It will be appreciated that the data received by the communication device is consistent with the data sent by the test device. The first delay time refers to the delay time when the communication result between the communication device and the test device is changed from abnormal to normal by continuously adjusting the initial delay time.
Specifically, based on the initial delay time obtained in step S110, the communication result between the communication device and the test device is a communication abnormality. For example, the theoretical delay time of the communication device is 104 microseconds, the test device sends data 0xaa to the communication device based on the initial delay time of 52 microseconds, and the communication result indicates that the communication is abnormal because the difference between the initial delay time and the theoretical delay time is large and the data received by the test device is not 0 xaa. And when the communication result is abnormal communication, adjusting the initial delay time to be close to the theoretical delay time, and when the communication result between the communication equipment and the test equipment indicates normal communication based on the adjusted delay time, recording the delay time adopted when the current communication is normal, and taking the delay time as the first delay time.
Optionally, when the adjusted initial delay time is close to the theoretical delay time, the unit delay time may be increased each time, or the initial delay time may be adjusted in stages, for example, when the difference between the initial delay time and the theoretical delay time is large, a large adjustment amount may be set, and when the difference between the initial delay time and the theoretical delay time is small, a small adjustment amount may be set. For example, based on the parameters of the communication device, the theoretical delay time of the communication device is 104 microseconds calculated according to the baud rate, based on the initial delay time of 52 microseconds, the test device sends data 0xaa to the communication device, because the difference between the initial delay time and the theoretical delay time is large, the data received by the communication device is not 0xaa, and the communication result between the communication device and the test device is communication abnormality at this time. When the communication result indicates that the communication is abnormal, the initial delay time may be increased by 1 microsecond, the initial delay time is adjusted to 53 microseconds, and based on the delay time of 53 microseconds, the test device sends data 0xaa to the communication device. And comparing whether the data received by the communication equipment is 0xaa, if not, continuing to increase the initial delay time to 54 microseconds, and sending the data 0xaa to the communication equipment by the test equipment based on the delay time of 54 microseconds. Comparing whether the data received by the communication device is 0xaa, if not, continuously increasing the initial delay time, theoretically, when the initial delay time is adjusted to be near the theoretical delay time, a situation that the communication is successful occurs, that is, the data received by the communication device is the same as the data of the test device, and is 0 xaa. For example, when the initial delay time is adjusted to 102 microseconds, the data received by the communication device is data 0xaa sent by the test device, and 102 microseconds is recorded as the first delay time.
S130, adjusting the first delay time until the communication is abnormal to obtain second delay time.
The second delay time refers to the delay time when the communication result between the communication equipment and the test equipment is changed from normal to abnormal by continuously adjusting the first delay time.
Specifically, based on the first delay time obtained in step S120, the communication result between the communication device and the test device is that the communication is normal. And when the communication result is normal communication, continuously adjusting the first delay time to be far away from the theoretical delay time, and when the communication result between the communication equipment and the test equipment is abnormal again based on the adjusted delay time, recording the delay time adopted by the communication equipment with abnormal communication last time, and taking the delay time as a second delay time.
Optionally, when the first delay time is adjusted to be away from the theoretical delay time, the unit delay time may be increased each time. For example, the first delay time obtained based on the above steps is 102 microseconds, the first delay time may be increased by a unit delay time of 1 microsecond, the first delay time is adjusted to 103 microseconds, and based on the delay time of 103 microseconds, the test device sends data 0xaa to the communication device. And comparing whether the data received by the communication equipment is 0xaa, if so, continuing to increase the initial delay time to 104 microseconds, and sending the data 0xaa to the communication equipment by the test equipment based on the delay time of 104 microseconds. And comparing whether the data received by the communication equipment is 0xaa, if so, continuing to increase the initial delay time, and if the data received by the communication equipment is not the data 0xaa sent by the test equipment until the first delay time is adjusted to 105 microseconds, recording the normal delay time 104 microseconds of the communication before the communication is abnormal as the second delay time.
And S140, determining a target delay time for communication with the test equipment according to the first delay time and the second delay time.
Wherein, the target delay time refers to the actual time used by the communication device to communicate the received data.
Specifically, an average value of the first delay time and the second delay time is calculated, and the average value is used as the target delay time. For example, if the first delay time obtained by the above steps is 102 microseconds and the second delay time is 104 microseconds, the finally determined target delay time is 103 microseconds.
The technical scheme of the embodiment determines the initial delay time according to the baud rate of the communication equipment, and communicates with the test equipment according to the initial delay time to obtain a communication result; when the communication result shows that the communication is abnormal, adjusting the initial delay time until the communication is normal to obtain a first delay time; adjusting the first delay time until the communication is abnormal to obtain a second delay time; and determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time. That is, in the embodiment of the present invention, the theoretical delay time is not directly used for communication, but an actual communication delay time (i.e., a target delay time) is obtained through communication test measurement, and the actual communication delay time is used for communication, so that the communication success rate can be improved.
Example two
Fig. 2 is a flowchart of a communication method according to a second embodiment of the present invention, where this embodiment is applicable to a case of single-wire serial port adaptive communication, and the present embodiment is optimized based on the above embodiment, and reference may be made to any of the above embodiments for technical details that are not described in detail in this embodiment. In this embodiment, determining the initial delay time according to the baud rate of the communication device includes: determining theoretical delay time according to the baud rate; and determining the initial delay time according to the theoretical delay time. Adjusting the initial delay time until the communication is normal to obtain a first delay time, comprising: and increasing the initial delay time until the communication is normal to obtain a first delay time. Adjusting the first delay time until the communication is abnormal to obtain a second delay time, comprising: and increasing the first delay time until the communication is abnormal to obtain a second delay time. Determining a target delay time for communicating with the test device according to the first delay time and the second delay time, comprising: and calculating the average value of the first delay time and the second delay time, and taking the average value as the target delay time.
As shown in fig. 2, the method of this embodiment specifically includes the following steps:
and S210, determining theoretical delay time according to the baud rate.
Wherein the theoretical delay time refers to a time theoretically used for communicating the received data calculated based on parameters of the communication device.
Specifically, the internal oscillation frequency of different communication devices is different, the internal oscillation frequency of the communication device is determined according to the different communication devices, and the baud rate has different calculation methods according to different working modes of serial ports of the communication devices. In the present embodiment, the operation mode 0 of the serial port of the communication device is selected, and therefore the baud rate is a fixed baud rate obtained by dividing the oscillation frequency by 12. And the theoretical delay time value of the communication equipment is one-half of the baud rate. That is, if the Baud rate of the communication device is 9600Baud, the theoretical delay time is 1/9600 sec, 104 μ sec.
And S220, determining initial delay time according to the theoretical delay time.
Specifically, the theoretical delay time is reduced to obtain the initial delay time. In the present embodiment, the theoretical delay time is generally reduced to 0.5 to 0.6 times of itself as the initial delay time.
And S230, communicating with the testing equipment according to the initial delay time to obtain a communication result.
And S240, when the communication result shows that the communication is abnormal, increasing the initial delay time until the communication is normal to obtain a first delay time.
Specifically, communication is performed between the communication device and the test device according to the initial delay time obtained in the above steps, and the communication result is communication abnormality because the initial delay time is only 0.5 to 0.6 times of the theoretical delay time. On the basis of the initial delay time, increasing the unit delay time to the initial delay time, communicating between the communication equipment and the test equipment on the basis of the increased delay time, if the communication is abnormal, continuing to increase the initial delay time until the communication between the communication equipment and the test equipment is normal, and recording the delay time when the communication is normal as the first delay time.
And S250, increasing the first delay time until the communication is abnormal to obtain a second delay time.
Specifically, the initial delay time is continuously adjusted and increased through the step S240 until the first delay time when the first communication is normal is obtained. And on the basis of the first delay time, increasing the unit delay time to the first delay time, carrying out communication between the communication equipment and the test equipment on the basis of the increased delay time, if the communication is normal, continuously increasing the initial delay time until the communication between the communication equipment and the test equipment is abnormal, and recording the delay time when the communication is abnormal at the previous time as the second delay time.
And S260, calculating the average value of the first delay time and the second delay time, and taking the average value as the target delay time.
Specifically, the average value of the first delay time and the second delay time obtained by the above steps is obtained by adding and dividing the two delay times, and the obtained average value is the actual time used by the communication device for communicating and receiving data.
According to the embodiment of the invention, the initial delay time is adjusted according to the communication result between the communication equipment and the test equipment, the first delay time and the second delay time of two endpoint times in a normal communication time area are obtained, the target delay time is determined according to the average value of the first delay time and the second delay time, and the target delay time is used for communication, so that the communication success rate can be improved.
EXAMPLE III
Fig. 3 is a flowchart of a communication method according to a third embodiment of the present invention, where this embodiment is applicable to a case of one-line serial port adaptive communication, and the present embodiment is optimized based on the foregoing embodiment, and reference may be made to any of the foregoing embodiments for technical details that are not described in detail in this embodiment. In this embodiment, communicating with the testing device according to the initial delay time to obtain a communication result includes: receiving test data sent by test equipment according to the initial delay time; and comparing the test data with the preset data, obtaining a communication result indicating normal communication when the test data is the same as the preset data, and obtaining a communication result indicating abnormal communication when the test data is different from the preset data.
As shown in fig. 3, the method of this embodiment specifically includes the following steps:
s310, determining initial delay time according to the baud rate of the communication equipment, and receiving test data sent by the test equipment according to the initial delay time.
The test data refers to data sent by the test equipment and actually received by the communication equipment. Since the communication between the test device and the communication device may be abnormal, the data received by the communication device is not necessarily the data transmitted by the test device.
Specifically, the communication device calculates the baud rate according to the parameters thereof, calculates the theoretical delay time according to the baud rate, and reduces the theoretical delay time to 0.5 to 0.6 times of the baud rate as the initial delay time. The delay time parameter of the communication device is set to an initial delay time, and based on the initial delay time, the communication device receives data transmitted by the test device.
And S320, comparing the test data with the preset data, obtaining a communication result indicating normal communication when the test data is the same as the preset data, and obtaining a communication result indicating abnormal communication when the test data is different from the preset data.
The preset data refers to data to be sent by preset testing equipment.
Specifically, the test data actually received by the communication equipment is compared with the preset data sent by the test equipment, and if the test data actually received by the communication equipment is the same as the preset data sent by the test equipment, the successful communication between the communication equipment and the test equipment is indicated, and a communication result with normal communication is obtained; if the test data actually received by the communication equipment is different from the preset data sent by the test equipment, the communication failure between the communication equipment and the test equipment is indicated, and a communication result with abnormal communication is obtained.
Further, before the communication device communicates with the test device to transmit data, the communication device and the test device protocol the data to be transmitted. After the communication equipment receives the test data, the received test data is returned to the test equipment, so that the test equipment can obtain a communication result based on the current delay time by comparing the sent preset data with the received data, and further determine whether to continue sending the test data to the communication equipment.
And S330, when the communication result shows that the communication is abnormal, adjusting the initial delay time until the communication is normal to obtain a first delay time.
S340, adjusting the first delay time until the communication is abnormal to obtain a second delay time.
And S350, determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time.
For example, taking the communication device as an MCU and the test device as a computer, the default data to be transmitted by both the MCU and the computer before communication data transmission is 0 xaa. Based on the initial delay time, the computer sends the preset data 0xaa to the MCU, the MCU receives the test data and then compares whether the test data is the preset data 0xaa, if not, the initial delay time is automatically adjusted, and the data actually received by the MCU is returned to the computer. Due to errors caused by the error between the initial delay time and the theoretical delay time, the data received by the computer is definitely not 0xaa, indicating abnormal communication. The computer repeatedly sends preset data 0xaa to the MCU, the actual data received by the MCU is not 0xaa, and the delay time is continuously increased; when the delay time is increased to a certain value, the test data received by the MCU is the same as the preset data sent by the computer, namely the communication between the MCU and the computer is normal based on the current delay time, and the current delay time is recorded as the first delay time. The computer continuously transmits preset data 0xaa to the MCU, the MCU compares whether the preset data is 0xaa after receiving the test data, if so, the MCU continuously increases the delay time, when the delay time is increased to a certain time value, the test data received by the MCU is inconsistent with the preset data transmitted by the computer, namely, the communication between the MCU and the computer is abnormal based on the current delay time, and the current delay time is recorded as a second delay time. And calculating the average value of the first delay time and the second delay time, taking the average value of the two delay times as the target delay time of the MCU, and setting a successful communication mark of the serial port of the MCU.
Fig. 4 is a flowchart of another communication method according to a third embodiment of the present invention, in which an oscillation frequency of a communication device is first set, a baud rate is determined according to the oscillation frequency, and a delay time is calculated after the oscillation frequency and the baud rate of the communication device are determined. And then, the test equipment continuously sends the same data, and the current delay time is recorded after the data received by the communication equipment is the same as the data sent by the test equipment. And when different data are received again, the test equipment stops sending and records the current delay time. And calculating the target delay time according to the two delay times. And finally, setting the delay time of the communication equipment as a target delay time to realize single-wire serial communication.
According to the embodiment of the invention, the communication result is obtained by comparing the test data actually received by the communication equipment with the preset data sent by the test equipment. And adjusting the delay time according to the communication result, further obtaining the target delay time and improving the success rate of communication.
Example four
Fig. 5 is a schematic structural diagram of a communication device according to a fourth embodiment of the present invention. As shown in fig. 5, the communication apparatus specifically includes: a communication module 410, a first adjustment module 420, a second adjustment module 430, and a determination module 440.
The communication module 410 is configured to determine an initial delay time according to the baud rate of the communication device, and communicate with the test device according to the initial delay time to obtain a communication result.
The first adjusting module 420 is configured to adjust the initial delay time until the communication is normal when the communication result indicates that the communication is abnormal, so as to obtain a first delay time.
The second adjusting module 430 is configured to adjust the first delay time until the communication is abnormal, so as to obtain a second delay time.
A determining module 440, configured to determine a target delay time for communicating with the testing device according to the first delay time and the second delay time.
In the communication device provided by the fourth embodiment of the present invention, the communication module determines the initial delay time according to the baud rate of the communication device, and communicates with the test device according to the initial delay time to obtain the communication result. And when the communication result shows that the communication is abnormal, the first adjusting module adjusts the initial delay time until the communication is normal to obtain the first delay time. And adjusting the first delay time by a second adjusting module until the communication is abnormal to obtain second delay time. And determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time through a determination module. That is, in the embodiment of the present invention, the theoretical delay time is not directly used for communication, but an actual communication delay time (i.e., a target delay time) is obtained through communication test measurement, and the actual communication delay time is used for communication, so that the communication success rate can be improved.
On the basis of the above embodiment, the communication module 410 includes:
and the first determining unit is used for determining the theoretical delay time according to the baud rate.
And the second determining unit is used for determining the initial delay time according to the theoretical delay time.
Further, the second determining unit is further configured to reduce the theoretical delay time to obtain the initial delay time.
Further, the first adjusting module 420 is specifically configured to increase the initial delay time until the communication is normal, so as to obtain the first delay time.
Further, the second adjusting module 430 is specifically configured to increase the first delay time until the communication is abnormal, so as to obtain a second delay time.
On the basis of the above embodiment, communicating with the test equipment according to the initial delay time to obtain a communication result, including:
and receiving the test data sent by the test equipment according to the initial delay time.
And comparing the test data with the preset data, obtaining a communication result indicating normal communication when the test data is the same as the preset data, and obtaining a communication result indicating abnormal communication when the test data is different from the preset data.
Further, the determining module 440 is specifically configured to calculate an average value of the first delay time and the second delay time, and use the average value as the target delay time.
The communication device provided by the embodiment can execute the communication method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects for executing the communication method.
EXAMPLE five
Fig. 6 is a schematic structural diagram of a communication device according to a fifth embodiment of the present invention. As shown in fig. 6, the apparatus includes a processor 510, a memory 520, an input device 530, and an output device 540; the number of processors 510 in the device may be one or more, and one processor 510 is taken as an example in fig. 6; the processor 510, the memory 520, the input device and 530, the output device 540 in the apparatus may be connected by a bus or other means, as exemplified by the bus connection in fig. 6.
The memory 520, which is a computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules, such as program modules corresponding to the communication method in the embodiment of the present invention (for example, the communication module 410, the first adjusting module 420, the second adjusting module 430, and the determining module 440 in the communication apparatus). The processor 510 executes various functional applications of the device and data processing by executing software programs, instructions, and modules stored in the memory 520, that is, implements the above-described communication method.
The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 520 may further include memory located remotely from processor 510, which may be connected to devices through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus. The output device 540 may include a display device such as a display screen.
EXAMPLE six
Fig. 7 is a schematic structural diagram of a communication system according to a sixth embodiment of the present invention. As shown in fig. 7, the communication system includes: a test device 60 and a communication device 70 for performing the communication method as described in any of the above embodiments.
The communication device 70 and the test device 60 may be configured to communicate predetermined data to be communicated before communicating the communication data. Based on the initial delay time, the test device 60 sends the preset data to the communication device 70, the communication device 70 compares whether the preset data is received after receiving the test data, if not, the initial delay time is automatically adjusted, and the actually received data is returned to the test device 60. Due to the error generated by the error between the initial delay time and the theoretical delay time, the data received by the test device 60 is definitely not the preset data, and represents the communication abnormality between the communication device 70 and the test device 60 based on the current delay time. The test device 60 repeatedly sends the preset data to the communication device 70, and if the actual data received by the communication device 70 is not the preset data, the delay time is continuously increased; when the delay time is increased to a certain value, the test data received by the communication device 70 is the same as the preset data sent by the test device 60, that is, the communication between the communication device 70 and the test device 60 is normal based on the current delay time, and the current delay time is recorded as the first delay time. The test device 60 continues to send the preset data to the communication device 70, the communication device 70 compares whether the received test data is the preset data or not after receiving the test data, if the received test data is the preset data, the communication device 70 continues to increase the delay time, and when the delay time is increased to a certain time value, the test data received by the communication device 70 is inconsistent with the preset data sent by the test device 60, that is, the communication between the communication device 70 and the test device 60 is abnormal based on the current delay time, and the current delay time is recorded as a second delay time. And calculating the average value of the first delay time and the second delay time, taking the average value of the two delay times as the target delay time of the communication equipment 70, and marking the successful serial port communication mark of the communication equipment 70.
In the communication system provided by the embodiment of the invention, the test equipment sends the preset data, and the communication equipment receives the test data. And adjusting the initial delay time according to the comparison result of the preset data and the test data to obtain a first delay time and a second delay time, and determining the target delay time according to the average value of the first delay time and the second delay time. That is, in the embodiment of the present invention, the theoretical delay time is not directly used for communication, but an actual communication delay time (i.e., a target delay time) is obtained through communication test measurement, and the actual communication delay time is used for communication, so that the communication success rate can be improved.
EXAMPLE seven
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a communication method, the method including:
determining initial delay time according to the baud rate of the communication equipment, and communicating with the test equipment according to the initial delay time to obtain a communication result;
when the communication result shows that the communication is abnormal, adjusting the initial delay time until the communication is normal to obtain a first delay time;
adjusting the first delay time until the communication is abnormal to obtain a second delay time;
and determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the communication method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the communication device, the included units and modules are merely divided according to the functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (11)

1. A method of communication, comprising:
determining initial delay time according to the baud rate of the communication equipment, and communicating with the test equipment according to the initial delay time to obtain a communication result;
when the communication result shows that the communication is abnormal, adjusting the initial delay time until the communication is normal to obtain first delay time;
adjusting the first delay time until communication is abnormal to obtain a second delay time;
and determining a target delay time for communicating with the test equipment according to the first delay time and the second delay time.
2. The communication method of claim 1, wherein said determining an initial delay time based on a baud rate of the communication device comprises:
determining theoretical delay time according to the baud rate;
and determining the initial delay time according to the theoretical delay time.
3. The communication method according to claim 2, wherein said determining the initial delay time according to the theoretical delay time comprises:
and reducing the theoretical delay time to obtain the initial delay time.
4. The communication method according to claim 3, wherein adjusting the initial delay time until the communication is normal, obtaining a first delay time, comprises:
and increasing the initial delay time until the communication is normal to obtain the first delay time.
5. The communication method according to claim 3, wherein adjusting the first delay time until communication is abnormal to obtain a second delay time comprises:
and increasing the first delay time until communication is abnormal to obtain the second delay time.
6. The communication method according to any one of claims 1 to 5, wherein the communicating with the test equipment according to the initial delay time to obtain the communication result comprises:
receiving test data sent by the test equipment according to the initial delay time;
and comparing the test data with preset data, obtaining a communication result indicating normal communication when the test data is the same as the preset data, and obtaining a communication result indicating abnormal communication when the test data is different from the preset data.
7. The communication method according to any one of claims 1 to 5, wherein the determining a target delay time for communication with the test device according to the first delay time and the second delay time comprises:
and calculating the average value of the first delay time and the second delay time, and taking the average value as the target delay time.
8. A communications apparatus, comprising:
the communication module is used for determining initial delay time according to the baud rate of the communication equipment and communicating with the test equipment according to the initial delay time to obtain a communication result;
the first adjusting module is used for adjusting the initial delay time until the communication is normal when the communication result shows that the communication is abnormal, so as to obtain first delay time;
the second adjusting module is used for adjusting the first delay time until the communication is abnormal to obtain second delay time;
and the determining module is used for determining the target delay time communicated with the test equipment according to the first delay time and the second delay time.
9. A communication device, characterized in that the communication device comprises:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the steps of the communication method as recited in any of claims 1 to 7.
10. A communication system comprising a test device and a communication device for performing the communication method according to any one of claims 1 to 7.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the communication method according to one of claims 1 to 7.
CN202011630481.6A 2020-12-31 2020-12-31 Communication method, device, equipment, system and storage medium Withdrawn CN112822069A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011630481.6A CN112822069A (en) 2020-12-31 2020-12-31 Communication method, device, equipment, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011630481.6A CN112822069A (en) 2020-12-31 2020-12-31 Communication method, device, equipment, system and storage medium

Publications (1)

Publication Number Publication Date
CN112822069A true CN112822069A (en) 2021-05-18

Family

ID=75855128

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011630481.6A Withdrawn CN112822069A (en) 2020-12-31 2020-12-31 Communication method, device, equipment, system and storage medium

Country Status (1)

Country Link
CN (1) CN112822069A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103002562A (en) * 2012-12-27 2013-03-27 天津大学 Hardware synchronizing method and system of wireless sensing network
CN105376066A (en) * 2015-12-15 2016-03-02 上海斐讯数据通信技术有限公司 Verification method for serial port communication and verification system
US10671558B1 (en) * 2018-12-18 2020-06-02 Simmonds Precision Products, Inc. Distributed time synchronization protocol for an asynchronous communication system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103002562A (en) * 2012-12-27 2013-03-27 天津大学 Hardware synchronizing method and system of wireless sensing network
CN105376066A (en) * 2015-12-15 2016-03-02 上海斐讯数据通信技术有限公司 Verification method for serial port communication and verification system
US10671558B1 (en) * 2018-12-18 2020-06-02 Simmonds Precision Products, Inc. Distributed time synchronization protocol for an asynchronous communication system

Similar Documents

Publication Publication Date Title
US11351820B2 (en) Tire positioning method and apparatus, electronic control unit and tire pressure sensor
CN112559412B (en) Serial port baud rate self-adaptive receiving end, realization method and system
WO2021082073A1 (en) Method and system for dynamic selection of storage partitions, computer device, and storage medium
CN114866250B (en) Method and device for constructing in-vehicle CAN network freshness value, vehicle and storage medium
CN113452770B (en) Data synchronization method, device, computer equipment and storage medium
CN112838980B (en) Message processing method, system, device, electronic equipment and storage medium
CN116760508B (en) Baud rate setting method and system
CN112822069A (en) Communication method, device, equipment, system and storage medium
CN108696335A (en) Transmission method, transmitting terminal and receiving terminal
CN109756464B (en) Communication method, server and client
CN110290552B (en) Method and device for measuring cache depth, storage medium and electronic device
US11606282B2 (en) Method and device for detecting network reliability
CN114827967B (en) Software updating method, bluetooth device and storage medium
US20230146130A1 (en) Reference signal resource configuration method and apparatus, device, and storage medium
CN112068414B (en) Multi-system timing method, device, equipment and medium
CN112532346A (en) Link self-adaption method and device based on user time requirement
CN112532355B (en) Data transmission method and device for mode switching based on link complexity
TW202022627A (en) Universal serial bus device and operation method thereof
CN116366499B (en) Data transmission method, device, electronic equipment and medium
CN110224794B (en) Communication data transmission method and system
CN110324095B (en) Multimode concurrency-based interference elimination method, device, equipment and storage medium
WO2003001738A1 (en) Method for detecting communication speed of apparatus
CN114125921B (en) Time delay measurement method and system, anchor point UPF entity
CN115622919A (en) Multiprocessor-based data transmission method and device and related components
CN115114217A (en) Method for improving data transmission quality, USB (universal serial bus) equipment and storage medium

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
CB02 Change of applicant information

Address after: 523000 Room 401 and 402, building 5, No. 24, industrial East Road, Songshanhu Park, Dongguan City, Guangdong Province

Applicant after: Guangdong daguangxin Technology Co.,Ltd.

Address before: 523808 the first, second and third floors of building 16, small and medium-sized science and technology enterprise Pioneer Park, North Industrial City, Songshanhu high tech Industrial Development Zone, Dongguan City, Guangdong Province

Applicant before: Guangdong Dapu Telecom Technology Co.,Ltd.

CB02 Change of applicant information
WW01 Invention patent application withdrawn after publication

Application publication date: 20210518

WW01 Invention patent application withdrawn after publication