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

By using a two-layer verification code method in serial communication, the data packets are repeatedly sent odd times and the final verification result is determined based on the majority feedback results, the problem of randomness and error feedback of verification results in serial data packet transmission is solved, and the reliability and effectiveness of data transmission are realized.

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

Patent Information

Application Number
CN202411575588.3
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 the field of serial communication technology, in the transmission of serial data packets caused by external environment interference, damage to the single-side transceiver at the sending or receiving end, or failure of the data transmission line, the feedback verification results are random, and the verification may not be passed or the incorrect feedback results may be obtained, resulting in the inability to complete the subsequent process.

Method used

A verification method is adopted to repeatedly send a first data packet by oddly numbering of each preset first interval time, the data packet including a serial data packet to be sent and a first verification code generated based on a predetermined first verification code generation method. If the receiving end sends the data message feedback signal for each time, if the verification result of most of the odd feedback signals is passed, the second data message is sent, including the odd number of times and the second verification code generated based on all odd number of first data messages and the second verification code generation method. The final verification result is the result of transmitting serial data packets.

Benefits of technology

Through the double-layer verification code method, the validity of the verification result of serial data packet transmission results is improved, and the probability that the final accepted data is correct is greatly improved, ensuring the stability of the communication environment and the reliable transmission of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544158A_ABST
    Figure CN119544158A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a serial communication data verification method, communication equipment, a storage medium and a processor, and belongs to the technical field of communication. The verification method is used for a serial data message sending end to verify odd number of serial data communication messages received by a receiving end through a first verification code, if most of verification results are that verification is passed, the communication environment is preliminarily judged to be credible, then all the odd number of serial data communication messages are verified through a second verification code, and the communication environment is judged to be credible. And if the second verification result also passes the verification, the communication environment can be judged to be stable, and most of the serial data communication messages passing the verification can be regarded as the data messages to be transmitted, so that the validity of the verification result can be improved.
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 serial communication data verification method, communication equipment, storage medium and processor. 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, the feedback verification results obtained by repeatedly sending the same serial data communication message are still random. When there are a lot of interference and faults, the verification may not be passed, and wrong feedback results may be obtained, resulting in the inability to complete subsequent processes based on the verification 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 improve the effectiveness of feedback verification results of serial data message transmission results.

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

[0007] Repeating sending the first data message an odd number of times at every preset first interval time, wherein the first data message includes: a serial data message to be sent, and a first check code generated based on a predetermined first check code generation method and the serial data message;

[0008] receiving a first feedback signal of the serial data message receiving end for each first data message sent, wherein the first feedback signal is a first verification result of the received serial data message based on the received first verification code and the first verification code generation method;

[0009] After completing the odd number of repeated transmissions of the first data message and receiving the odd number of feedback signals, if the majority of the first verification results in the odd number of feedback signals are verified, sending the second data message at an interval of a preset second interval time, wherein the second data message includes: the odd number of times, and a second check code generated based on all the odd number of first data messages and the second check code generation method;

[0010] receiving a second feedback signal of the serial data message receiving end for the second data message, the second feedback signal being a second verification result of verifying all received serial data messages based on the received second verification code and the second verification code generation method; and

[0011] The second verification result is used as the final verification result of the transmitted serial data message.

[0012] Furthermore, the verification method for serial communication data also includes: if the second verification result is failure, re-execute the steps of the above verification method.

[0013] Optionally, the first data message also includes one or more of the following: an agreed message header identifier, a variable message length, and a weighted value of each data in the serial data message.

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

[0015] According to the feedback result of the serial data message receiving end on the message header identifier, the final verification result is corrected;

[0016] Correct the final verification result according to the feedback result of the serial data message receiving end for the variable message length; or

[0017] When the first data message includes a weighted value, the first check code generation method includes generating the first check code based on the weighted value.

[0018] Preferably, verifying a first verification result of the received serial data message based on the received first verification code and the first verification code generation method includes:

[0019] Generate a third check code based on the received serial data message and the first check code generation method;

[0020] If the third verification code is the same as the received first verification code, the first verification result is passed verification; and

[0021] If the third verification code is different from the received first verification code, the first verification result is failure to pass the verification.

[0022] Optionally, the first verification code generation method is the same as or different from the second verification code generation method.

[0023] Preferably, the serial data message transmitter includes a master transmitter and at least one slave transmitter, wherein the master transmitter generates data to be sent to form a serial data message and transmits it to at least one slave transmitter; and the at least one slave transmitter distributes the processed serial data message to one or more serial data message receivers.

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

[0025] Continuously receiving a first data message repeatedly sent by a serial data message sending end, and distinguishing two adjacent serial data communication messages received according to a first interval time, wherein the first data message includes: a serial data message to be sent, and a first check code generated based on a predetermined first check code generation method and the serial data message;

[0026] Verify the received serial data message based on the received first verification code and the first verification code generation method to obtain a first verification result, and send the first verification result to the serial data message sending end;

[0027] After the received first data message reaches a preset odd number of times, if most of the first check results of all the received first data messages are passed, receiving a second data message sent by the serial data message sending end, wherein the second data message includes: the odd number of times, and a second check code generated based on all the odd number of first data messages and the second check code generation method;

[0028] Based on the received second check code and the second check code generation method, all received serial data messages are checked to obtain a second check result, which is sent to the serial data message sending end and used as the final check result of the transmitted serial data message.

[0029] Furthermore, the verification method for serial communication data also includes: if the second verification result is failure, re-execute the steps of the above verification method.

[0030] Optionally, the first data message also includes one or more of the following: an agreed message header identifier, a variable message length, and a weighted value of each data in the serial data message.

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

[0032] According to the feedback result of the serial data message receiving end on the message header identifier, the final verification result is corrected;

[0033] Correct the final verification result according to the feedback result of the serial data message receiving end for the variable message length; or

[0034] When the first data message includes a weighted value, the first check code generation method includes generating the first check code based on the weighted value.

[0035] Preferably, verifying the received serial data message based on the received first verification code and the first verification code generation method to obtain a first verification result includes:

[0036] Generate a third check code based on the received serial data message and the first check code generation method;

[0037] If the third verification code is the same as the received first verification code, the first verification result is passed verification; and

[0038] If the third verification code is different from the received first verification code, the first verification result is failure to pass the verification.

[0039] Optionally, the first verification code generation method is the same as or different from the second verification code generation method.

[0040] Preferably, the serial data message receiving end includes a plurality of receiving ends, wherein the plurality of receiving ends respectively receive data distributed by the serial data message sending end, and respectively send feedback of the received data to the serial data message sending end.

[0041] 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 serial communication data verification method of the present application.

[0042] 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 communication data verification method of the present application.

[0043] 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 serial communication data verification method of the present application.

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

[0045] Through the above technical scheme, the odd-numbered serial data communication messages received by the receiving end are first checked by the first check code. If most of the check results are passed, it is preliminarily determined that the communication environment is reliable. Then, all the odd-numbered serial data communication messages are checked by the second check code. If the second check result is also passed, it can be determined that the communication environment is stable, and most of the serial data communication messages that have passed the check can be regarded as data messages to be transmitted, thereby improving the validity of the check result.

[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 It is a flow chart of an embodiment of a method for checking serial communication data of the present invention;

[0049] Figure 2 yes Figure 1 The embodiment is a data flow diagram for a multi-circuit board serial data verification;

[0050] Figure 3 yes Figure 2 The 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 In the embodiment, m times of repeated transmission 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 method for verifying serial communication data. The embodiment 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. The embodiment is used at the data sending end to determine the reliability of the message data received by the receiving end, and then determine whether to accept the data sent in the batch or discard the batch of data and resend it. Figure 1 As shown, the verification method of serial communication data includes the following steps:

[0058] Step S101, repeatedly sending a first data message an odd number of times at every preset first interval time, wherein the first data message includes: a serial data message to be sent, and a first check code generated based on a predetermined first check code generation method and the serial data message;

[0059] Step S102, receiving a first feedback signal of the serial data message receiving end for each first data message sent, wherein the first feedback signal is a first verification result of verifying the received serial data message based on the received first verification code and the first verification code generation method;

[0060] Step S103, after completing the odd number of repeated transmissions of the first data message and receiving the odd number of feedback signals, if the majority of the first verification results in the odd number of feedback signals are through verification, then sending the second data message at an interval of a preset second interval time, wherein the second data message includes: the odd number of times, and the second verification code generated based on all the odd number of first data messages and the second verification code generation method;

[0061] Step S104, receiving a second feedback signal of the serial data message receiving end for the second data message, the second feedback signal being a second verification result of verifying all received serial data messages based on the received second verification code and the second verification code generation method; and

[0062] Step S105: The second verification result is used as the final verification result of the transmitted serial data message.

[0063] It should be noted that the serial message data communication between the circuit board or the intelligent chip 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 sent an odd number of times in step S101 is the same message data, so as to ensure that the receiving end determines the message data to be sent according to the odd number of messages received. At the same time, the interval time between each repeated transmission, that is, the first interval time, is intended to avoid data adhesion between the serial data communication messages sent twice. 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. For example, it can be an integer multiple of the verification time used by the receiving end to complete the verification.

[0064] In addition, in step S101, the first data message includes: a serial data message to be sent, and a first check code generated based on a predetermined first check code generation method and the serial data message. That is, each single data message itself includes a check code according to the data to be sent, and the receiving end can check the received message data according to the received check code to determine the reliability of the single transmission. At the same time, in step S102, the sending end can determine the reliability of the single transmission according to the first feedback signal fed back by the receiving end for the current transmission, that is, the first check result.

[0065] It should also be noted that, in the present embodiment, both the transmitting end and the receiving end support full-duplex synchronous serial communication, and therefore step S101 and step S102 may occur alternately or simultaneously. For example, after the transmitting end completes sending the previous message, it will receive a first feedback signal from the receiving end regarding the received message at an interval. If the time of receiving the feedback signal is also the first interval time described in step S101, the transmitting end must receive the feedback signal for the previous message while completing sending the next message, that is, execute the above steps S101 and S102 simultaneously.

[0066] According to step S103, the sending end preliminarily determines that the current environment is stable and reliable, and most of the transmitted message data are valid transmissions when all the scheduled odd-numbered message transmissions are completed and all odd-numbered feedback signals are received, and most of the feedback results are verified. The sending end sends a message related to the overall verification, including the total number of transmissions and the overall verification code for all transmitted messages, wherein the total number of transmissions can be used to determine whether the receiving end has received all the messages of the transmission times, and the overall verification code for all transmitted messages can be used to verify the message data preliminarily determined to be valid transmissions, and further determine the reliability of the message data to be received. That is, the second feedback signal received by the sending end in step S104 is the second feedback signal obtained by the receiving end based on the total number of transmissions received and the overall verification code for all transmitted messages. According to step S105, the second feedback signal, that is, the second verification result, is used as the final result for determining the reliability of the message data received by the receiving end, and then determines whether to accept the data sent in the batch or discard the batch of data and resend it.

[0067] In some embodiments, the serial communication data verification method further includes:

[0068] Step S106: If the second verification result is failed, re-execute the above steps S101 to S105.

[0069] In some implementations, the first data message further includes one or more of the following: an agreed message header identifier, a variable message length, and a weighted value of each data in the serial data message, so as to improve the validity of judging the single transmission verification result, or improve the validity of judging the overall transmission result. Among them, the feedback result of the serial data message receiving end for the message header identifier and the feedback result of the serial data message receiving end for the variable message length can be used to correct the final verification result and improve the validity of judging the overall transmission result; when the first data message includes a weighted value, the first verification code generation method includes generating the first verification code based on the weighted value, which can be used to improve the validity of the single transmission verification result.

[0070] In some embodiments, the received serial data message is verified based on the received first verification code and the first verification code generation method to obtain a first verification result, which can be: a third verification code is generated based on the received serial data message and the first verification code generation method; if the third verification code is the same as the received first verification code, the first verification result is passed; if the third verification code is different from the received first verification code, the first verification result is failed.

[0071] It should be noted that the methods for generating the first verification code and the second verification code may be the same or different.

[0072] It should also be noted that in step S103, "the first verification results of the majority of the odd-numbered feedback signals are passed", where "majority" can be a majority of more than 50%, or a majority of more than 75%. The specific standard can be determined by technicians based on the severity of the risk event or the amount of loss caused by data transmission errors.

[0073] In some implementations, the second data message may be sent only if the verification result is verified to be passed after 5 or more verifications are scheduled to be sent 7 times. Further, if the verification result is verified to be passed after 7 or more verifications are scheduled to be sent 7 times, the second data message may be sent repeatedly and the prerequisite for sending the second data message may be amended to: if the verification result is verified to be passed after 8 or more verifications are sent 11 times, the second data message may be sent.

[0074] In some embodiments, there are multiple circuit boards or smart chips involved in serial data communication, for example, the serial data message transmitter includes a master transmitter and at least one slave transmitter, wherein the master transmitter generates data to be sent to form a serial data message and transmits it to at least one slave transmitter; at least one slave transmitter distributes the processed serial data message to one or more serial data message receivers. For another example, the serial data message receiver includes multiple receivers, wherein the multiple receivers respectively receive the data distributed by the serial data message transmitter, and respectively send feedback on the received data to the serial data message transmitter.

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

[0076] 1. The double-layer verification code improves the validity of the verification result, greatly increasing the probability that the final received data is correct data.

[0077] In the process of completing multiple repeated transmissions, the validity of the transmission result is verified each time, and when most of the single transmissions are valid, it is preliminarily determined that the data obtained through the verified majority of transmissions can be accepted, and then the number of transmissions in this round and the overall verification code for all the transmission messages are sent to the receiving end to determine whether the receiving end has received the messages of all transmission times, and further determine the reliability of the message data to be received.

[0078] 2. The second check code is sent only when the first check code obtains a satisfactory result in the majority of the repeatedly transmitted data messages. If it is not satisfied, the second check code continues to be sent repeatedly and the specific number of transmissions and the number of transmissions that pass the check in the judgment condition for sending the second data message are corrected, thereby ensuring the probability of successful data transmission.

[0079] The embodiment of the present invention further provides a method for verifying serial communication data, which is used for a serial data message receiving end. The method for verifying serial communication data includes:

[0080] Step 1: continuously receiving a first data message repeatedly sent by a serial data message transmitter, and distinguishing two adjacent serial data communication messages received according to a first interval time, wherein the first data message includes: a serial data message to be sent, and a first check code generated based on a predetermined first check code generation method and the serial data message;

[0081] Step 2: verifying the received serial data message based on the received first verification code and the first verification code generation method to obtain a first verification result, and sending the first verification result to the serial data message sending end;

[0082] Step 3: After the number of received first data messages reaches a preset odd number, if most of the first check results of all received first data messages are through the check, receiving a second data message sent by the serial data message sending end, wherein the second data message includes: an odd number of times, and a second check code generated based on all odd first data messages and the second check code generation method;

[0083] Step 4: Based on the received second check code and the second check code generation method, all received serial data messages are checked to obtain a second check result, and the second check result is sent to the serial data message sending end, and the second check result is used as the final check result of the transmitted serial data message.

[0084] By comparing the steps of this embodiment with the above-mentioned embodiment for the serial data message sending end, it can be seen that the above-mentioned steps 1-4 can be coordinated with steps S101-S105 to realize the sending and receiving of message data between the data receiving end and the data sending end, and finally determine the validity of the received and sent message data. The details of this embodiment can refer to the previous embodiment and its optional implementation mode, and will not be repeated here.

[0085] The following takes an actual data to be sent as an example, combined with Figure 2-6 , illustrating that the serial communication data 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 determines whether the received message data is acceptable.

[0086] like Figure 2As 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.

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

[0088] 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:

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

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

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

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

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

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

[0095] Figure 4 The data to be sent in this example is shown as a message after the initial packaging. Figure 5 In the m times (m is an odd number) of repeated transmissions shown in the figure, after each message is sent, it waits for time1 before sending the next message. After all m messages are sent, it waits for time1 again, and then sends the overall verification message about all m messages. Wherein, time1 is an integer multiple of the transmission verification value time; each single transmission message, that is, the first data message described in step S101 and step 1, includes a CRC1 check code, such as Figure 4 As shown, the CRC1 check value is placed at the end of the message. The overall check message sent after completing all m transmissions includes the following: Figure 5 The CRC check code shown, the CRC check value can be transmitted separately.

[0096] 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:

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

[0098] 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;

[0099] 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;

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

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

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

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

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

[0105] Table 1

[0106] 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

[0107] 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:

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

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

[0110] 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).

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

[0112] Table 2

[0113]

[0114]

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

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

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

[0118] The receiving end determines whether the received single message data can pass the verification according to the received message data, and determines whether all the sent message data can be accepted. Specifically, the sending end and the receiving end cooperate with each other to complete the verification process of serial communication data as follows:

[0119] After receiving each data message, the serial data receiving end generates a check code according to the received valid data and compares it with the received check code. If the two are equal, it means that the message obtained by the data transmission has passed the check, that is, the first check result in step S103 has passed the check. If the two are not equal, it means that the message data transmitted this time has been subjected to external interference during the communication process, and the message obtained by the data transmission this time cannot pass the check;

[0120] The receiving end feeds back the single verification result to the sending end, that is, the first feedback signal described in step S102;

[0121] The sending end repeatedly completes sending of all m data messages, and after receiving feedback results of the m data messages, if most of the m feedback results pass the verification, for example, 5 or more of the 9 transmissions pass the verification, then after a predetermined interval time, that is, the second interval time described in step S103, a second data message is sent;

[0122] After receiving the second data message, the receiving end determines whether the receiving end has received all the messages of the transmission times according to the total number of transmission times included in the second data message, and further verifies the message data preliminarily determined to be effectively transmitted according to the overall verification code for all the transmission messages included in the second data message, and then determines the reliability of the message data to be received, that is, the second verification result described in step S104, and determines whether to accept the data sent in the batch or discard the batch of data and resend it, and also feeds back the second verification result to the sending end;

[0123] The sending end determines whether the data sent in the batch is accepted according to the received second verification result. If not accepted, the sending of the data to be sent is restarted, that is, steps S101-S105 are completed again.

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

[0125] 1. Verification of header identification

[0126] 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-flip processing on the subsequent data.

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

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

[0129] 2. Verification of message length

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

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

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

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

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

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

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

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

[0138] 1. The double-layer verification code improves the validity of the verification result, greatly increasing the probability that the final received data is correct data.

[0139] In the process of completing multiple repeated transmissions, the validity of the transmission result is verified each time, and when most of the single transmissions are valid, it is preliminarily determined that the data obtained through the verified majority of transmissions can be accepted, and then the number of transmissions in this round and the overall verification code for all the transmission messages are sent to the receiving end to determine whether the receiving end has received the messages of all transmission times, and further determine the reliability of the message data to be received.

[0140] 2. 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.

[0141] 3. In the case of repeated transmission and failure to pass the double-layer check, all messages are abandoned and transmission is restarted to prevent failures or interference caused by accidental factors and ensure the probability of successful data transmission.

[0142] An embodiment of the present invention provides a communication device, including a communication module for receiving and / or sending serial data, wherein the communication module is configured to implement the verification method of serial communication data of the present application. The communication device includes a processor and a memory, wherein the communication module configured to implement the verification method of serial communication data 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.

[0143] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to determine whether the communication environment is reliable and stable, thereby improving the effectiveness of the verification result.

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

[0145] 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 serial communication data verification method of the present application is implemented.

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

[0147] The embodiment of the present invention provides a device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the serial communication data 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.

[0148] 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 method for initializing the serial communication data verification of the present application.

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

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

[0151] 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 including 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.

[0152] 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 A step that specifies a function in one or more boxes.

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

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

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

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

[0157] 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 method for verifying serial communication data, used for a serial data message sending end, the method for verifying serial communication data comprising: Repeating sending a first data message an odd number of times at every preset first interval, wherein the first data message includes: a serial data message to be sent, and a first check code generated based on a predetermined first check code generation method and the serial data message; receiving a first feedback signal of a serial data message receiving end for each first data message sent, wherein the first feedback signal is a first verification result of the received serial data message based on the received first verification code and the first verification code generation method; After completing the odd number of repeated transmissions of the first data message and receiving the odd number of feedback signals, if the majority of the first verification results in the odd number of feedback signals are through verification, sending the second data message at an interval of a preset second interval time, wherein the second data message includes: the odd number of times, and a second check code generated based on all odd number of the first data messages and the second check code generation method; receiving a second feedback signal of the serial data message receiving end for a second data message, wherein the second feedback signal is a second verification result of verifying all received serial data messages based on the received second verification code and the second verification code generation method; and The second verification result is used as the final verification result for transmitting the serial data message.

2. The method for verifying serial communication data according to claim 1, characterized in that: Also includes: If the second verification result is a failure, the verification method as claimed in claim 1 is executed again.

3. The method for verifying serial communication data according to claim 1, characterized in that: The first data message also includes one or more of the following: an agreed message header identifier, a variable message length, and a weighted value of each data in the serial data message.

4. The serial communication data verification method according to claim 3, characterized in that: Also includes one or more of the following: Correcting the final verification result according to the feedback result of the serial data message receiving end for the message header identifier; Correcting the final verification result according to the feedback result of the serial data message receiving end for the variable message length; or When the first data message includes the weighted value, the first check code generation method includes generating the first check code based on the weighted value.

5. The serial communication data verification method according to claim 1, characterized in that: The first verification result of verifying the received serial data message based on the received first verification code and the first verification code generation method includes: Generate a third check code based on the received serial data message and the first check code generation method; If the third verification code is the same as the received first verification code, the first verification result is passed verification; and If the third verification code is different from the received first verification code, the first verification result is failure to pass the verification.

6. The method for verifying serial communication data according to any one of claims 1 to 5, characterized in that: The first verification code generation method is the same as or different from the second verification code generation method.

7. The method for verifying serial communication data according to claim 1, characterized in that: The serial data message sending end includes a master sending end and at least one slave sending end, The master transmitting end generates data to be transmitted to form the serial data message, and transmits the data to the at least one slave transmitting end; and The at least one slave transmitting end distributes the processed serial data message to one or more serial data message receiving ends.

8. A method for verifying serial communication data, used at a serial data message receiving end, the method for verifying serial communication data comprising: Continuously receiving a first data message repeatedly sent by a serial data message sending end, and distinguishing two adjacent serial data communication messages received according to a first interval time, wherein the first data message includes: a serial data message to be sent, and a first check code generated based on a predetermined first check code generation method and the serial data message; Verifying the received serial data message based on the received first verification code and the first verification code generation method to obtain a first verification result, and sending the first verification result to the serial data message sending end; After the received first data message reaches a preset odd number of times, if most of the first check results of all the received first data messages are passed, receiving a second data message sent by the serial data message sending end, wherein the second data message includes: the odd number of times, and a second check code generated based on all the odd number of the first data messages and the second check code generation method; Based on the received second verification code and the second verification code generation method, all received serial data messages are verified to obtain a second verification result, and the second verification result is sent to the serial data message sending end, and the second verification result is used as the final verification result for transmitting the serial data message.

9. The method for verifying serial communication data according to claim 8, characterized in that: Also includes: If the second verification result is failure, the verification method as claimed in claim 9 is executed again.

10. The serial communication data verification method according to claim 8, characterized in that: The first data message also includes one or more of the following: an agreed message header identifier, a variable message length, and a weighted value of each data in the serial data message.

11. The serial communication data verification method according to claim 10, characterized in that: Also includes one or more of the following: Correcting the final verification result according to the feedback result of the serial data message receiving end for the message header identifier; Correcting the final verification result according to the feedback result of the serial data message receiving end for the variable message length; or When the first data message includes the weighted value, the first check code generation method includes generating the first check code based on the weighted value.

12. The serial communication data verification method according to claim 8, characterized in that: The step of verifying the received serial data message based on the received first verification code and the first verification code generation method to obtain a first verification result includes: Generate a third check code based on the received serial data message and the first check code generation method; If the third verification code is the same as the received first verification code, the first verification result is passed verification; and If the third verification code is different from the received first verification code, the first verification result is failure to pass the verification.

13. The method for verifying serial communication data according to any one of claims 8 to 12, characterized in that: The first verification code generation method is the same as or different from the second verification code generation method.

14. The serial communication data verification method according to claim 8, characterized in that: The serial data message receiving end includes a plurality of receiving ends, wherein the plurality of receiving ends respectively receive the data distributed by the serial data message sending end, and respectively send feedback of the received data to the serial data message sending end.

15. 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 serial communication data verification method according to any one of claims 1 to 14.

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

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

18. 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 communication data verification method according to any one of claims 1 to 14.