Verification method of serial data communication, communication equipment, medium and processor

By repeatedly sending the original and inverse packets at intervals in serial data communication, and judging the stability of data transmission based on the verification signal of the receiver, the reception error problems caused by external interference and transceiver failure in serial data communication are solved, and higher data transmission stability and transceiver service life are achieved.

CN119544157APending Publication Date: 2025-02-28CERI DIGITAL TECHNOLOGY (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411575587.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In serial data communication, external environment interference and transceiver failure make it difficult for the receiver to receive data correctly, and repeated sending of messages increases the risk of transceiver damage.

Method used

A verification method is adopted, by repeatedly sending serial data communication messages every certain time, using the original code and the inverse code when the adjacent two transmissions are sent, and waiting for the verification signal from the receiving end after even transmissions is completed, we determine whether there is a problem with the line based on the received data equalization degree.

Benefits of technology

It reduces the risk of damage to one-sided transceiver, improves the stability and correctness of data transmission, and can effectively identify and diagnose the causes of transmission errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544157A_ABST
    Figure CN119544157A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a serial data communication verification method, communication equipment, a medium and a processor, and belongs to the technical field of communication. The serial data communication verification method is used for a data sending end and comprises the steps that the same serial data communication message is repeatedly sent for even number times, and in two adjacent times of sending, an original code of the serial data communication message is sent for one time, and an inverse code of the serial data communication message is sent for the other time; waiting for a first interval time every time the serial data communication message is sent, and starting the next sending; after the even number of repeated sending is completed, a verification signal sent by the receiving end is waited, whether a problem exists in a serial data communication line or not is determined according to the verification signal, and the verification signal is determined based on the data balance degree of all serial data communication messages which are received by the receiving end and repeatedly sent for the even number of times. The verification method can determine whether a serial data communication line has a problem or not under the condition of greatly reducing the risk of damage of the single-side transceiver.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a verification method, communication equipment, medium and processor for serial data communication. Background Art

[0002] In the field of serial communication technology, for example, serial message data communication between circuit boards or smart chips is sometimes affected by external environmental interference, damage to the transceiver on one side of the transmitter or receiver, or failure of the data transmission line itself. In order to ensure that the receiver correctly receives the serial message data, the same serial data communication message is often sent repeatedly, and the verification result is fed back for each transmission.

[0003] However, when there is external environmental interference, a large number of repeated transmissions of the same serial data communication message will increase the risk of damage to the transceiver on one side, and it is difficult to identify the problem of transmission error based on the transmission results.

[0004] The inventors of this application discovered during the process of implementing the present invention that the above technical problems have not yet been solved. Summary of the invention

[0005] The purpose of the embodiment of the present invention is to provide a verification method, which can determine whether there is a problem with the serial data communication line while greatly reducing the risk of damage to the single-side transceiver.

[0006] In order to achieve the above object, an embodiment of the present invention provides a verification method for serial data communication, which is used at a data sending end. The verification method includes:

[0007] Repeating the sending of the serial data communication message at each first interval;

[0008] In two adjacent transmissions, one is to transmit the original code of the serial data communication message, and the other is to transmit the inverse code of the serial data communication message; and

[0009] After completing the predetermined even number of transmissions, wait for the check signal sent by the receiving end, and determine whether there is a problem with the serial data communication line based on the check signal, wherein the check signal is determined based on the data balance of the serial data communication message received by the receiving end.

[0010] Preferably, the data balance is an energy balance of the serial data communication message received by the receiving end, and when the energy balance reaches a preset deviation threshold, it is determined that there is a problem with the serial data communication line.

[0011] Furthermore, the energy balance is the ratio of the total number of bits 1 to the total number of bits 0 in the serial data communication message received by the receiving end.

[0012] Preferably, the preset deviation threshold includes a plurality of thresholds, and the severity of the problem existing in the serial data communication line is determined according to the order of magnitude of the plurality of thresholds.

[0013] Further, the multiple thresholds include 20%, 50% and 80%.

[0014] Furthermore, the verification method of serial data communication also includes one or more of the following:

[0015] If the energy balance is equal to 50%, it is determined that there is no transmission balance problem in the serial data communication line;

[0016] If the energy balance is less than 50% and greater than 20%, it is determined that the serial data communication line has a problem of external energy interference injected into the transmission line;

[0017] If the energy balance is greater than 50% and less than 80%, it is determined that there is an energy leakage problem in the serial data communication line; or

[0018] If the energy balance is less than 20% or greater than 80%, it is determined that the serial data communication line is in an unavailable state and the network settings need to be checked.

[0019] Furthermore, each time a serial data communication message is sent, a check code for checking the serial data communication message is also sent.

[0020] Furthermore, the verification method of serial data communication also includes:

[0021] After completing an even number of repeated transmissions, waiting for a data retransmission signal or a data confirmation signal sent by the receiving end based on all received serial data communication messages; and

[0022] Based on the data retransmission signal, the serial data communication message is confirmed to have been transmitted, or based on the data confirmation signal, the serial data communication message is restarted to be sent repeatedly for an even number of times.

[0023] On the other hand, the present invention also provides a verification method for serial data communication, which is used at a data receiving end. The verification method includes:

[0024] Continuously receive serial data communication messages sent repeatedly by the data transmitter an even number of times;

[0025] Distinguishing two consecutively received serial data communication messages according to the first interval time, wherein one of the two consecutively received serial data communication messages is an original code and the other is an inverted code; and

[0026] After receiving an even number of serial data communication messages, a check signal is determined based on the data balance of the received serial data communication messages, and the check signal is sent to the data sending end, so that the data sending end determines whether there is a problem with the serial data communication line according to the check signal.

[0027] Preferably, the data balance is the energy balance of the received serial data communication message, and when the energy balance reaches a preset deviation threshold, it is determined that there is a problem with the serial data communication line.

[0028] Furthermore, the energy balance is the ratio of the total number of bits 1 to the total number of bits 0 in the received serial data communication message.

[0029] Preferably, the preset deviation threshold includes a plurality of thresholds, and the severity of the problem existing in the serial data communication line is determined according to the order of magnitude of the plurality of thresholds.

[0030] Further, the multiple thresholds include 20%, 50% and 80%.

[0031] Furthermore, the verification method of serial data communication also includes one or more of the following:

[0032] If the energy balance is equal to 50%, it is determined that there is no transmission balance problem in the serial data communication line;

[0033] If the energy balance is less than 50% and greater than 20%, it is determined that the serial data communication line has a problem of external energy interference injected into the transmission line;

[0034] If the energy balance is greater than 50% and less than 80%, it is determined that there is an energy leakage problem in the serial data communication line; or

[0035] If the energy balance is less than 20% or greater than 80%, it is determined that the serial data communication line is in an unavailable state and the network settings need to be checked.

[0036] Furthermore, the serial data communication verification method further includes: confirming whether there is a transmission error in the currently received serial data communication message according to a verification code in the received serial data communication message.

[0037] Furthermore, the verification method of serial data communication also includes:

[0038] Convert the received serial data communication message into the original code;

[0039] If the same serial data communication messages account for the majority of all serial data communication messages, a data confirmation signal is sent to the data sending end; and

[0040] If the same serial data communication messages account for a minority of all serial data communication messages, a data retransmission signal is sent to the data transmitting end.

[0041] On the other hand, the present invention also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute: the serial data communication verification method of the present application.

[0042] On the other hand, the present invention also provides a processor for running a program, wherein the program, when being run, is used to execute: the verification method for serial data communication of the present application.

[0043] On the other hand, the present invention also provides a computer program product, including a computer program, which implements the serial data communication verification method of the present application when executed by a processor.

[0044] On the other hand, the present invention also provides a communication device, including a communication module for receiving and / or sending serial data, and the communication module is configured to implement the verification method of serial data communication of the present application.

[0045] Through the above technical scheme, the same serial data communication message is sent repeatedly an even number of times, and one of the two messages sent is the original code and the other is the inverted code, which can ensure the energy balance of the data sent by the sending end, and then the data received by the receiving end can also achieve energy balance to the greatest extent, thereby greatly reducing the risk of damage to the unilateral transceiver of the sending end and the receiving end. The message is resent at a certain interval until an even number of transmissions are completed. The receiving end feeds back a check signal to the sending end based on the data balance of all the received serial data communication messages, so as to determine whether there is a problem with the serial data communication line according to the check signal.

[0046] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0048] Figure 1 is a flow chart of an embodiment of a verification method for serial data communication of the present invention;

[0049] Figure 2 yes Figure 1 A data flow diagram of a multi-circuit board serial data verification embodiment;

[0050] Figure 3 yes Figure 2The communication flow chart of multi-circuit board serial data verification shown;

[0051] Figure 4 yes Figure 1 Schematic diagram of a single message data structure in an embodiment;

[0052] Figure 5 yes Figure 1 Even number of repeated transmissions in the embodiment Figure 4 The single message schematic diagram shown;

[0053] Figure 6 yes Figure 5 Schematic diagram of CRC check code generation shown. DETAILED DESCRIPTION

[0054] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0055] If there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0056] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations. In addition, it should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components, and models may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0057] The embodiment of the present invention provides a verification method for serial data communication, which is intended to be applied to full-duplex synchronous serial communication between multiple circuit boards or smart chips included in an intelligent control system of a production line, and is used at the data sending end. Figure 1 As shown, the verification method of serial data communication includes the following steps:

[0058] Step S101, repeatedly sending a serial data communication message to be sent at a first interval time;

[0059] Step S102, in two adjacent transmissions, one is to transmit the original code of the serial data communication message, and the other is to transmit the inverse code of the serial data communication message;

[0060] Step S103, after completing the predetermined even number of transmissions, wait for a check signal sent by the receiving end, and determine whether there is a problem with the serial data communication line based on the check signal, wherein the check signal is determined based on the data balance of the serial data communication message received by the receiving end.

[0061] The serial message data communication between circuit boards or smart chips is often affected by external interference of the production environment, the data transmission line itself and other faults. In order to ensure that the receiving end correctly receives the message data to be sent, the same data message is often sent repeatedly. Therefore, the serial data communication message repeatedly sent in step S101 is the same message data, so as to ensure that the receiving end determines the message data to be sent based on the messages received multiple times. At the same time, the interval time between each repeated transmission is to avoid data adhesion between the serial data communication messages sent twice, wherein the first interval time can be determined based on experience or the resolution ability of the receiving end, as long as the data messages sent before and after can be distinguished.

[0062] In step S102, the original code is sent once and the inverse code is sent once for every two data messages sent, so that the data sent twice can achieve data balance, and then in step S103, to complete the even number of data messages sent, it is ensured that all the sent data achieve data balance. If the overall data of all data messages received by the receiving end is not balanced, it can be explained that there is a problem in the overall transmission network of the data message; if the data of the two adjacent data messages currently received by the receiving end is not balanced, it can be explained that there is a problem with the current data transmission; if the receiving end continues to judge the two adjacent data messages received, and the judgment result is: sometimes the data is balanced, sometimes the data is not balanced, it can be explained that the current data transmission is unstable. In this embodiment, the check signal sent by the receiving end in step S103 can be the judgment result of the data balance of the two adjacent data messages, or the judgment result of the overall data balance of all data messages, or the judgment result of the distribution of the data balance of each two adjacent data messages in all data messages, and can even include all of the above judgment results, and then determine the reliability and stability of the current data transmission environment according to the obtained judgment result.

[0063] In some embodiments, the data balance is the energy balance of the serial data communication message received by the receiving end, and specifically can be the ratio of the total number of bit 1s to the total number of bit 0s in the serial data communication message received by the receiving end. When the energy balance reaches the preset deviation threshold, it is determined that there is a problem with the serial data communication line. The preset deviation threshold can be multiple thresholds, and the severity of the problem with the serial data communication line is determined according to the order of the multiple thresholds. For example, the preset deviation threshold is set to 20%, 50% and 80%.

[0064] Specifically, when the energy balance of the received serial data communication message is equal to 50%, it is considered that the serial data communication line is quite perfect and there is no transmission balance problem; when the energy balance of the received serial data communication message is less than 50% and greater than 20%, it is determined that the serial data communication line has the problem of external energy interference injected into the transmission line; when the energy balance of the received serial data communication message is greater than 50% and less than 80%, it is determined that the serial data communication line has the problem of energy leakage; when the energy balance of the received serial data communication message is less than 20% or greater than 80%, it is determined that the serial data communication line is in an unavailable state and the network settings need to be checked.

[0065] In some implementations, in order to determine whether each single transmitted data message is correctly received, a verification code for verifying the serial data communication message is also sent each time the serial data communication message is sent.

[0066] In some implementations, based on the result of determining whether there is a problem with the transmission line, it is further determined whether the message data to be transmitted can be correctly received, and whether the message data needs to be retransmitted. Specifically, the following steps may be performed:

[0067] After completing an even number of repeated transmissions, waiting for a data retransmission signal or a data confirmation signal sent by the receiving end based on all received serial data communication messages;

[0068] Based on the data retransmission signal, confirm that the serial data communication message has completed transmission; or

[0069] Based on the data confirmation signal, restart the even number of repeated serial data communication messages.

[0070] It should be noted that the above-mentioned data retransmission signal is an instruction signal for the receiving end to determine that the batch of serial data communication messages received is not accepted and to request retransmission; the data confirmation signal is an instruction signal for the receiving end to determine that the batch of serial data communication messages received is accepted, and it can be considered that the message data to be sent is correctly received.

[0071] Compared with the prior art, the technical advantages of this embodiment are:

[0072] 1. In the serial data communication messages that are repeatedly sent, one of the two adjacent messages is transmitted in the original code and the other is transmitted in the inverse code, and the number of repeated transmissions is an even number, which can ensure the energy balance on the sending end side and maximize the energy balance of the message data received on the receiving end side, thereby minimizing the risk of damage to the unilateral transceiver of the data sending end and the receiving end, improving the service life of the transceiver, and increasing the success rate of correctly sending and receiving message data;

[0073] 2. At the receiving end, based on the data balance or energy balance of the received message, it is easy to determine whether there is a problem in the overall transmission path, and then identify the severity and possible causes of the problem based on the degree of deviation of the data balance or energy balance.

[0074] An embodiment of the present invention provides a verification method for serial data communication, which is used at a data receiving end. The verification method comprises the following steps:

[0075] Step 1, continuously receiving the serial data communication message repeatedly sent by the data sending end an even number of times;

[0076] Step 2: distinguishing two adjacent received serial data communication messages according to the first interval time, wherein one of the two adjacent received serial data communication messages is the original code and the other is the inverse code; and

[0077] Step 3: after receiving an even number of serial data communication messages, determine a check signal based on the data balance of the received serial data communication messages, and send the check signal to the data sending end, so that the data sending end determines whether there is a problem with the serial data communication line according to the check signal.

[0078] The above steps one to three respectively correspond to steps S101-S103 in the above embodiment for the data sending end, with the only difference being that the present embodiment is for the data receiving end, while the previous embodiment is for the data sending end. The data receiving end and the data sending end cooperate with each other to determine whether there is a problem with the data transmission line or the transmission environment through the energy balance of the transmission result of the data message repeatedly transmitted an even number of times. For details, please refer to the previous embodiment, which will not be elaborated here.

[0079] The above-mentioned data balance is the energy balance of the serial data communication message received by the receiving end, which can be specifically the ratio of the total number of bit 1s to the total number of bit 0s in the serial data communication message received by the receiving end. When the energy balance reaches the preset deviation threshold, it is determined that there is a problem with the serial data communication line. The preset deviation threshold can be multiple thresholds, and the severity of the problem with the serial data communication line is determined according to the order of the multiple thresholds. For example, the preset deviation threshold is set to 20%, 50% and 80%.

[0080] Specifically, when the energy balance of the received serial data communication message is equal to 50%, it is considered that the serial data communication line is quite perfect and there is no transmission balance problem; when the energy balance of the received serial data communication message is less than 50% and greater than 20%, it is determined that the serial data communication line has the problem of external energy interference injected into the transmission line; when the energy balance of the received serial data communication message is greater than 50% and less than 80%, it is determined that the serial data communication line has the problem of energy leakage; when the energy balance of the received serial data communication message is less than 20% or greater than 80%, it is determined that the serial data communication line is in an unavailable state and the network settings need to be checked.

[0081] In some implementations, in order to determine whether each single data message sent is correctly transmitted, it is also confirmed whether there is a transmission error in the currently received serial data communication message based on the check code in the received serial data communication message.

[0082] In some implementations, based on the result of determining whether there is a problem with the transmission line, it is further determined whether the message data to be transmitted can be correctly transmitted, and whether the message data needs to be retransmitted. Specifically, the following steps may be performed:

[0083] Convert the received serial data communication message into the original code;

[0084] If the same serial data communication messages account for the majority of all serial data communication messages, a data confirmation signal is sent to the data sending end; and

[0085] If the same serial data communication messages account for a minority of all serial data communication messages, a data retransmission signal is sent to the data sending end.

[0086] It should be noted that the above-mentioned data retransmission signal is an instruction signal for the receiving end to determine that the batch of serial data communication messages received is not accepted and to request retransmission; the data confirmation signal is an instruction signal for the receiving end to determine that the batch of serial data communication messages received is accepted, and it can be considered that the message data to be sent is correctly received.

[0087] To further illustrate the specific details of the above embodiment, the following takes an actual data to be sent as an example. Figure 2-6 , explaining how the serial data communication verification method of the present application completes the process of multiple repeated transmissions of the actual data with the cooperation of the data sending end and the receiving end, and how to determine whether there is a problem with the transmission line based on the received message data.

[0088] like Figure 2 As shown, the transmitting end of this example includes circuit board 1 and circuit board 2, wherein the iMX6 in circuit board 1 is the core intelligent chip, and as a full-duplex synchronous serial communication master station, it actively sends data message Data1 to the slave station, and synchronously receives the data message Data2 fed back by the slave station; the STM32F407 in circuit board 2 serves as a full-duplex synchronous serial communication slave station, passively receives the data message Data1 sent by the master station, and synchronously sends the data message Data2 to the master station.

[0089] At the same time, the STM32F407 of circuit board 2, as the middle link of the communication chain, is also responsible for splitting the upper data message into Data11 and Data12. Data11 is sent to circuit board 3 through one data signal, and Data12 is sent to circuit board 4 through another signal. At the same time, the data message Data21 fed back by circuit board 3 is fed back to the STM32F407 chip of circuit board 2, and the data message Data22 fed back by circuit board 4 is fed back to the STM32F407 chip of circuit board 2. The STM32F407 chip of circuit board 2 splices Data21 and Data22 to form the data message Data2, which is sent to the iMX6 chip of the upper circuit board 1.

[0090] like Figure 3 As shown in the figure, the actual data transmission process between circuit boards 1, 2, 3, and 4 in this example includes:

[0091] Circuit board 1 sends a configuration message with a length of 9 and a message identifier of 0xF500. The configuration data information is 0x00FF, indicating that all 8 digital input and output signals are configured as digital outputs; 0x3000 indicates activating the 1st encoder signal, deactivating the 2nd encoder signal, and deactivating all 6 high-speed counter signals; 0x0001 indicates starting this configuration.

[0092] After receiving the data message, circuit board 2 immediately determines whether the message identifier is 0xF500. If it is the identifier, it starts to configure internal information, feeds back the configuration message, and enters the configuration state S12.

[0093] After receiving the feedback configuration data message, circuit board 1 checks whether the CRC check is correct. If not, return to initialization state S1; otherwise, check whether the data length is the configuration data length. If not, return to initialization state S1; check whether the feedback identifier is 0x00F8. If correct, enter the intermediate state S2; otherwise, return to initialization state S1.

[0094] After entering the intermediate state S2, the data message is sent to circuit board 2. If circuit board 2 is in the initialization state S1, it continues to feedback the configuration message; after circuit board 1 receives the data message, it checks whether the data length of the feedback message is equal to the configuration message length, and then returns to the initial state S1. If the data length of the feedback message is equal to the data message length, it returns to the intermediate state S2.

[0095] If circuit board 2 is in cycle state 2, it feeds back a data message; after circuit board 1 receives the correct data message, it enters cycle communication state S3 and starts sending data messages.

[0096] After the circuit board 2 is in the periodic communication state S22, if the communication times out, it enters the initialization state S21; otherwise, it continues to return to the periodic communication state S22 and waits for the data message sent by the circuit board 1.

[0097] Figure 4 The data to be sent in this example is shown as a message after the initial packaging. Figure 5 In the m (m is an even number) repeated transmissions shown, the original code and the bit-inverted inverse code are transmitted alternately, and after each single transmission of the message, the time1 is waited, and time1 is an integer multiple of the transmission check value time. Each single transmission message also includes a CRC1 check code, such as Figure 4 As shown, the CRC1 check value is placed at the end of the message. After completing all m transmissions, a CRC check code is also generated, such as Figure 5 As shown, the CRC check value can be transmitted separately.

[0098] The generation of the CRC1 check code and the CRC check code can be obtained according to the same or different check code generation algorithms. In this example, the data to be sent is Data0-Data8, and the following is used: Figure 6 The verification code generation algorithm shown in the figure, the verification code generation process includes the following steps:

[0099] Get the number of valid data n, and calculate the weighted value k corresponding to each valid data;

[0100] If n is an odd number, first calculate the weighted value of the first half of the data, that is, the weighted value of the valid data with a number less than (n-1) / 2. For the i-th data (i starts from 1 to n), the corresponding weighted value ki is 2^(i-1), and increases in multiples of 2. For the weighted value of the second half of the valid data, decrease in multiples of 2;

[0101] After multiplying the effective data Data with the weighted value, the first-level intermediate result L1Data is calculated. The two adjacent data in the L1Data are subjected to a bitwise XOR operation to calculate L2Data. If the number of L1Data is an odd number, the middle data does not participate in the XOR operation;

[0102] The above calculations are performed one by one until a 16-bit data is finally calculated as the CRC check value obtained this time.

[0103] If n is an even number, a data is automatically added to the end of the data, and the data value is 0, to construct a new n+1 data. The subsequent processing is the same as the previous paragraph.

[0104] In this example, the data to be sent includes 9 valid data Data0-Data8. When the number of intermediate result data is equal to 3, the first and second data are subjected to bitwise XOR operation as the next-level calculation result 1; the second and third data are subjected to bitwise XOR operation as the next-level calculation result 2. The calculation result 1 and the calculation result 2 are subjected to bitwise XOR operation as the final CRC check value.

[0105] by Figure 2 Take the configuration message data of circuit board 3 in the example to illustrate the implementation process of verification:

[0106] 1. The message definition required by circuit board 3 is shown in Table 1 below.

[0107] Table 1

[0108] Relative URL Data Definition Sending Data Feedback data 0 Head 0xA5A5 0x5A5A 1 IO_DataLen 9 IO_DataLen_fdk 2 Data0 0xF500 retData0 3 Data1 0x00FF retData1 4 Data2 0x032A retData2 5 Data3 0x3000 retData3 6 Data4 0x0000 retData4 7 Data5 0x0000 retData5 8 Data6 0x0000 retData6 9 Data7 0x0000 retData7 10 Data8 0x0001 retData8 11 CRC16 CRC retCRC

[0109] 2. The sender circuit board 2 calculates the CRC value according to the check code generation algorithm and completes the packaging of the data message. The generated single-sent message includes the following parts:

[0110] Head is the header identifier 0xA5A5, IO_DataLen is 9, indicating that the valid data length of this message is 9 16-bit data (i.e. 16 words), and the corresponding valid data is Data0~8.

[0111] PI_DataLen is 0, indicating the effective communication data length of circuit board 4, which is not involved in this communication.

[0112] Among them, Data0~8 are valid data for this communication; CRC16 with offset address 42 and 43 are both verification values ​​of this communication data, which are 2 equal data; CRC16 with offset address 43 is invalid data sent additionally, which is used to trigger the slave station to feedback the last data (i.e., feedback verification value retCRC).

[0113] The process of calculating the CRC value according to the check code generation algorithm is shown in Table 2 below. The calculated CRC check value is 0xF3B4.

[0114] Table 2

[0115]

[0116] 3. The receiving end calculates the feedback data retCRC based on the received CRC check value and verifies the received data.

[0117] As shown in Table 2, dummy is the first 16-bit data fed back, which is invalid data and needs to be discarded; the header identifier of the feedback is 0x5A5A, and IO_DataLen_fdk is 9, indicating that the valid data length of this message is 9 16-bit data (i.e., 16 words), and the corresponding valid data is retData0~8; PI_DataLen_fdk is 0, indicating the effective communication data length of circuit board 4, which is not involved in this communication; retData0~8 are the valid data fed back for this communication; and retCRC with an offset address of 43 are all data check values ​​fed back for this communication.

[0118] In this example, the method for calculating the feedback data retCRC is the same as that for calculating the CRC check value, and will not be described in detail.

[0119] The receiving end determines whether there is a problem with the serial data communication line based on the received message data. The specific process is as follows:

[0120] After receiving all the messages, the serial data receiver extracts m message data and counts the data of each bit. If it is logic 1 / high level, the high level count value is increased by 1; if it is logic 0 / low level, the low level count value is increased by 1.

[0121] The number of data bits transmitted by the network is equal to the sum of the high-level count value and the low-level count value; the high-level count value divided by the number of data bits transmitted by the network is used as the energy balance during network transmission. If the energy balance is 50%, it means that the network transmission balance is optimal. If the value is not equal to 50%, it means that external energy interference has occurred during network transmission. If the value is greater than 50%, it means that the interference signal is injected into the network from the outside; otherwise, it means that the interference signal is leaked from the network to the outside. If the value is greater than 80% or less than 20%, the network hardware settings need to be rechecked and the network is unavailable; otherwise, the network data can be restored through the verification algorithm.

[0122] In some implementations, after receiving all messages, the serial data receiving end performs an overall CRC check of the m message data and compares it with the received CRC value. If the above two values ​​are equal, it means that all data are correct, and arbitrarily selects one single message for subsequent data processing. If the above two values ​​are not equal, it means that the serial data is subject to external interference during the communication process, resulting in data errors, and a secondary check is required.

[0123] In some implementations, the serial data receiving end also performs separate checks on m messages in sequence, and the check method is the same as the encryption method, that is, the same weighting coefficient and check method are used to calculate the CRC check value of the data, and then compare it with the CRC check value actually received.

[0124] In some implementations, the serial data transmitting end and receiving end cooperate to complete the verification through the auxiliary identifier and the double-layer verification code, which may be:

[0125] Add the transmission data header identifier and the length of the transmitted data to a single message, and send the check code CRC1 after the entire single message is transmitted. The sender calculates and integrates the transmitted data according to the agreed message header identifier, variable message length, weighted value and check value calculation method to complete the single message transmission. After receiving all the messages, the data receiving end verifies in a "first overall and then partial" manner. First, calculate the CRC of the overall message and compare it with the received CRC for verification; then perform verification calculations on each message separately.

[0126] For a single message verification calculation, first check whether the message header feature identifier is correct; then count the message length and determine the final message length based on the "more than half" method.

[0127] Determine the message length according to the above steps, calculate the data check value of a single message according to the pre-agreed weighted value, and compare and check it with the received CRC1.

[0128] For the messages that pass the above verification, CRC1 value statistics are performed, and the final CRC1 is determined in a "more than half" manner.

[0129] The message with message header identification, message length and CRC1 check is taken as the final real data message for the next step of data processing.

[0130] In some implementations, the serial data receiving end further performs the following verification according to a predetermined message packing rule:

[0131] 1. Verification of header identification

[0132] First, check whether the header identifier is a special value agreed upon by the sender and receiver. If the header identifier is equal to the special value, it means that the data message is the original data message, and there is no need to perform bit flipping on the subsequent data.

[0133] If the header identifier is not equal to the special value, try again to compare with the bit-inverted special value. If the header identifier is equal to the bit-inverted special value, it means that this data message is a bit-inverted data message, and the subsequent data needs to be bit-flipped before subsequent verification work can be carried out.

[0134] If the above checks are not equal, the message is directly judged as an error and no further verification calculation is performed.

[0135] 2. Verification of message length

[0136] Check the message transmission length. For the message lengths in m messages, if all the lengths are the same, then the data is the correct message length. Otherwise, according to the numerical statistical method, the number of different message lengths is counted, and the data exceeding m / 2 is considered to be the final correct data and used as the real message length. For example, m=3, a total of 3 messages are transmitted repeatedly, and the received message lengths are: 9, 20, and 9. Since 9 is repeated 2 times, it exceeds m / 2=1.5 times, so the message length is 9.

[0137] If the above judgment is not passed, all messages will be discarded and the message transmission will be invalid.

[0138] According to the message length determined in the previous step, the data of the single message is verified. If the single message is equal to the message length in the previous step according to the transmission length, the data verification value is calculated, and the calculation method is shown above. Compare the actual CRC1 verification value with the received CRC1 verification value. If these two values ​​are equal, it means that the message output is correct and the data is available; otherwise, the data transmitted this time is incorrect, and all the data transmitted this time is discarded.

[0139] 3. Verification of CRC1 check code in single transmission

[0140] For the messages that pass the single message CRC1 check, the number of them is counted as p, and the CRC values ​​of all messages are counted and compared. If all CRC1s are the same, the data is the correct message length. Otherwise, according to the numerical statistical method, the number of different CRC1s is counted, and the data exceeding p / 2 is considered to be the final correct data and used as the real message length. For example, p=3, a total of 3 messages are transmitted repeatedly, and the received message lengths are: 0xF3B4, 0xF3B4, 0xFFF4. Since 0xF3B4 is repeated 2 times, exceeding p / 2=1.5 times, the CRC1 is 0xF3B4.

[0141] For a single message with CRC1 equal to 0xF3B4, one message is randomly selected as the final data message for subsequent data processing.

[0142] If the above judgment is not passed, all messages will be discarded and the message transmission will be invalid.

[0143] Compared with the prior art, the technical advantages of this embodiment are:

[0144] 1. The original code and the inverse code of the message are transmitted alternately, and an even number of single message transmissions are completed. The number of level flips on the network transmission line is equal, thereby achieving energy balance. The power consumption of the network transceiver is also equal, avoiding damage to the network transceiver on one side;

[0145] 2. At the receiving end, based on the data balance or energy balance of the received message, it is easy to determine whether there is a problem in the overall transmission path, and then identify the severity and possible causes of the problem based on the degree of deviation of the data balance or energy balance;

[0146] 3. At the message sending end, according to the predetermined message packaging rules, auxiliary identification and double-layer verification code are used to enhance the validity of the verification result.

[0147] An embodiment of the present invention provides a communication device, including a communication module for receiving and / or sending serial data, the communication module being configured to implement the verification method of serial data communication of the present application. The communication device includes a processor and a memory, the communication module configured to implement the verification method of serial data communication of the present application is stored in the memory as a program unit, and the processor executes the program unit stored in the memory to implement the corresponding function.

[0148] The processor includes a kernel, which calls the corresponding program unit from the memory. The kernel can be set to one or more, and the kernel parameters can be adjusted to determine whether there is a problem with the serial data communication line and reduce the risk of damage to the single-side transceiver.

[0149] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0150] An embodiment of the present invention provides a storage medium on which a program is stored. When the program is executed by a processor, the verification method of serial data communication of the present application is implemented.

[0151] An embodiment of the present invention provides a processor, which is used to run a program, wherein the serial data communication verification method of the present application is executed when the program is running.

[0152] The embodiment of the present invention provides a device, which includes a processor, a memory, and a program stored in the memory and can be run on the processor, and the processor implements the serial data communication verification method of the present application when executing the program. The device in this article can be a server, a PC, a PAD, a mobile phone, etc.

[0153] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program steps of the verification method for initializing serial data communication of the present application.

[0154] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0155] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0156] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0157] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0158] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0159] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0160] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0161] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0162] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A verification method for serial data communication, used at a data transmitting end, the verification method comprising: Repeating the sending of the serial data communication message at each first interval; In two adjacent transmissions, one is to send the original code of the serial data communication message, and the other is to send the inverse code of the serial data communication message; as well as After completing a predetermined even number of transmissions, wait for a check signal sent by the receiving end, and determine whether there is a problem with the serial data communication line based on the check signal, wherein the check signal is determined based on the data balance of the serial data communication message received by the receiving end.

2. The serial data communication verification method according to claim 1, characterized in that: The data balance is the energy balance of the serial data communication message received by the receiving end, and when the energy balance reaches a preset deviation threshold, it is determined that there is a problem with the serial data communication line.

3. The serial data communication verification method according to claim 2, characterized in that: The energy balance degree is the ratio of the total number of bit 1s to the total number of bit 0s in the serial data communication message received by the receiving end.

4. The serial data communication verification method according to claim 2, characterized in that: The preset deviation threshold includes a plurality of thresholds, and the severity of the problem existing in the serial data communication line is determined according to the order of magnitude of the plurality of thresholds.

5. The serial data communication verification method according to claim 4, characterized in that: The plurality of thresholds include 20%, 50% and 80%.

6. The serial data communication verification method according to any one of claims 2 to 5, characterized in that: Also includes one or more of the following: If the energy balance is equal to 50%, it is determined that there is no transmission balance problem in the serial data communication line; If the energy balance is less than 50% and greater than 20%, it is determined that the serial data communication line has a problem of external energy interference injected into the transmission line; If the energy balance is greater than 50% and less than 80%, it is determined that there is an energy leakage problem in the serial data communication line; or If the energy balance degree is less than 20% or greater than 80%, it is determined that the serial data communication line is in an unavailable state and the network setting needs to be checked.

7. The serial data communication verification method according to claim 6, characterized in that: Each time the serial data communication message is sent, a check code for checking the serial data communication message is also sent.

8. The serial data communication verification method according to claim 6, characterized in that: Also includes: After completing the even number of repeated transmissions, waiting for a data retransmission signal or a data confirmation signal sent by the receiving end based on all received serial data communication messages; and Based on the data retransmission signal, confirm that the serial data communication message has completed transmission, or based on the data confirmation signal, restart the even-numbered repetition of sending the serial data communication message.

9. A verification method for serial data communication, used at a data receiving end, the verification method comprising: Continuously receive serial data communication messages sent repeatedly by the data transmitter an even number of times; Distinguishing two consecutively received serial data communication messages according to the first interval time, wherein one of the two consecutively received serial data communication messages is an original code and the other is an inverse code; as well as After receiving the even number of serial data communication messages, a check signal is determined based on the data balance of the received serial data communication messages, and the check signal is sent to the data sending end, so that the data sending end determines whether there is a problem with the serial data communication line according to the check signal.

10. The serial data communication verification method according to claim 9, characterized in that: The data balance is the energy balance of the received serial data communication message, and when the energy balance reaches a preset deviation threshold, it is determined that there is a problem with the serial data communication line.

11. The serial data communication verification method according to claim 10, characterized in that: The energy balance is the ratio of the total number of bit 1s to the total number of bit 0s in the received serial data communication message.

12. The serial data communication verification method according to claim 10, characterized in that: The preset deviation threshold includes a plurality of thresholds, and the severity of the problem existing in the serial data communication line is determined according to the order of magnitude of the plurality of thresholds.

13. The serial data communication verification method according to claim 12, characterized in that: The plurality of thresholds include 20%, 50% and 80%.

14. The serial data communication verification method according to any one of claims 10 to 13, characterized in that: Also includes one or more of the following: If the energy balance is equal to 50%, it is determined that there is no transmission balance problem in the serial data communication line; If the energy balance is less than 50% and greater than 20%, it is determined that the serial data communication line has a problem of external energy interference injected into the transmission line; If the energy balance is greater than 50% and less than 80%, it is determined that there is an energy leakage problem in the serial data communication line; or If the energy balance degree is less than 20% or greater than 80%, it is determined that the serial data communication line is in an unavailable state and the network setting needs to be checked.

15. The serial data communication verification method according to claim 14, characterized in that: Also includes: According to the check code in the received serial data communication message, it is confirmed whether there is a transmission error in the currently received serial data communication message.

16. The serial data communication verification method according to claim 14, characterized in that: Also includes: Convert the received serial data communication message into the original code; If the same serial data communication messages account for the majority of all serial data communication messages, a data confirmation signal is sent to the data sending end; and If the same serial data communication messages account for a minority of all serial data communication messages, a data retransmission signal is sent to the data transmitting end.

17. A machine-readable storage medium having instructions stored thereon, the instructions being used to cause a machine to execute: the serial data communication verification method according to any one of claims 1 to 16.

18. A processor, characterized in that: Used to run a program, wherein the program, when run, is used to execute: a verification method for serial data communication according to any one of claims 1 to 16.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the serial data communication verification method according to any one of claims 1 to 16.

20. A communication device, comprising a communication module for receiving and / or sending serial data, characterized in that: The communication module is configured to implement the verification method for serial data communication according to any one of claims 1 to 16.