Vehicle-mounted controller local area network data recovery method and system
Through signal trend analysis and cyclic redundancy verification code calculation, CAN bus data is quickly repaired, which solves the problem of data transmission susceptible to interference in the prior art, and improves the robustness and security of on-board CAN communication.
Patent Information
- Application Number
- CN202411159880.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-01
AI Technical Summary
In the face of collision failure and high-voltage insulation failure, data transmission is susceptible to interference, resulting in CRC verification failure and packet discarding, which may lead to vehicle safety problems. The existing error correction method consumes a lot of CPU time, reducing Communication robustness.
Signal trend analysis and cyclic redundant check code calculation are used to quickly locate the mutation value and change it to a close stable value until the check value is consistent, data repair is achieved, and repair tags are added during the data repair process to improve safety.
It improves the robustness of on-board CAN communication, prevents key signal loss caused by communication interference, shortens data repair time, and enhances system stability and security.
Smart Images

Figure CN118890261A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle-mounted controller local area network communication, and more specifically, to a vehicle-mounted controller local area network data repair method and system. Background Art
[0002] With the rapid development of automotive industry and industrial automation technology, the number of electronic control units (ECUs) in vehicles and industrial equipment is increasing, and data communication between these units is becoming increasingly important. CAN (Controller Area Network) bus technology has become a widely used communication standard in these fields due to its high reliability, real-time and flexibility.
[0003] The CAN bus was originally developed by Bosch in Germany in the mid-1980s and is mainly used for communication between on-board ECUs. It uses differential signal transmission to represent data through the voltage difference between CAN_H (high-level line) and CAN_L (low-level line), effectively resisting common-mode interference and improving the robustness of communication. The CAN bus has features such as multi-master structure, message arbitration, error detection and processing, and can support communications at different speed levels to meet data transmission requirements in various complex environments.
[0004] In vehicle-mounted and industrial automation systems, the CAN bus carries a large amount of control instructions and status information, and its stability and reliability are directly related to the operation of the entire system. However, due to the increasing complexity of the system and the interference of the external environment, various faults are inevitable during the CAN bus data transmission process. If these faults are not repaired in time, they may lead to system performance degradation, equipment damage, and even safety accidents. Therefore, the development of efficient and reliable CAN bus data repair technology is of great significance to ensure the stable operation of the system.
[0005] In the prior art, in the CAN network communication of the vehicle controller, in order to ensure the accuracy of the data, when sending a frame of CAN message, the controller will perform CRC (cyclic redundancy check code) check on the data, and place CRC at the beginning and end of the message, and form a frame of data with the data to send to the bus. When other controllers receive this frame of message, they will perform CRC calculation on the data again. Because the same CRC algorithm is used for data generation and data reception, when the CRC calculated by the receiving controller for the data is consistent with the received CRC, it indicates that the received data is accurate. On the contrary, when the calculated CRC is inconsistent with the received CRC, it indicates that the received data has been tampered with after being sent from the sending node, and the data is unreliable. Although the use of CRC check can ensure the accuracy of the data, when the data is arbitrarily tampered with, even if only one bit is tampered with, it will cause the data of the entire message to be invalid, which makes the robustness of CAN communication not high, especially for collision faults and high-voltage insulation faults. Other problems will appear very soon after such faults occur. If the bus data fails to check the CRC due to interference and discards these messages, the controller will not receive the fault state, which will have very serious consequences for vehicle safety.
[0006] Prior art announcement number: CN114362882A, application date: 2021
[0007] On December 29, 2014, a 256-byte data error correction method based on CAN bus was disclosed. The method performs CRC calculation on the transmitted data before transmission and after transmission. The erroneous data is corrected by modifying the signal within the defined range and calculating the CRC again for the newly composed message. The calculation result is compared with the received CRC until they are consistent. However, for signals such as vehicle speed, rotation speed, voltage, and current, the value coverage range is large. If the above method is used, a lot of attempts are required, which will consume CPU running time and reduce the robustness of CAN bus communication.
[0008] Therefore, the present invention provides a vehicle controller area network data repair method and system with a data repair function that can improve the robustness of vehicle-mounted CAN communication, avoid excessive consumption of CPU running time, and prevent the controller from losing key signals due to communication interference. Summary of the invention
[0009] The present invention provides a vehicle-mounted controller local area network data repair method and system, which realizes that the data repair function can be repaired quickly, further improving the robustness of vehicle-mounted CAN communication; and can prevent the controller from losing key signals due to communication interference, such as collision status, accelerator pedal signal, brake signal, etc.
[0010] In order to achieve the above object, the present invention adopts the following technical scheme:
[0011] In a first aspect, the present invention provides a method for repairing data in a vehicle controller local area network, the method comprising:
[0012] Calculate the cyclic redundancy check code of the received message data to obtain the received check value;
[0013] Determine whether the received checksum value is the same as the original checksum value;
[0014] If the received checksum value is different from the original checksum value, data repair is performed on the received message, and the data repair includes signal trend analysis;
[0015] Signal trend analysis includes:
[0016] Traverse the data in the received message and locate the mutation value;
[0017] The mutation value is changed, and after the mutation value is changed to a value close to the stable value, repair data is obtained, and the stable value is a signal of the same type as the mutation value signal in the received message of other frames;
[0018] Calculate the cyclic redundancy check code of the repair data to obtain a repair check value, and determine whether the repair check value is the same as the original check value;
[0019] Repeat changing the mutation value until the repaired checksum value is the same as the original checksum value;
[0020] The current repair data is used to replace the received message containing the mutation value and stored to obtain a repair message.
[0021] The present invention provides a method for repairing data of a vehicle-mounted controller local area network, comprising: if a received check value is different from an original check value, performing data repair on a received message, the data repair comprising signal trend analysis, quickly locating a mutation value in the signal trend analysis, that is, data that may be tampered with, then attempting to change the mutation value, and obtaining repair data after the mutation value is changed to a value close to a stable value, performing cyclic redundancy check code calculation on the repair data, and performing verification until the repair check value is the same as the original check value, thereby completing data repair. The signal trend analysis process in the method provided by the present invention can narrow the scope of data attempts during the data repair process, quickly find possible correct data, accelerate data analysis and repair of important signals, further improve the robustness of vehicle-mounted CAN communication, and prevent the controller from losing key signals due to communication interference.
[0022] In a possible implementation, data repair also includes rationality analysis, which includes: traversing the signals in the received message; locating suspicious signals through the defined range of each signal; changing the suspicious signal, changing the suspicious signal to a new signal within the defined range, and obtaining a repair signal; performing cyclic redundancy check code calculation on the repair signal to obtain a repair check value, and comparing the repair check value with the original check value; repeatedly changing the suspicious signal until the repair check value is the same as the original check value; replacing the message where the suspicious signal is located with the current repair signal and storing it to obtain a repair message.
[0023] In a possible implementation, after performing data repair on the received message, a repair tag is added to the repaired message.
[0024] In a possible implementation, before performing cyclic redundancy check calculation on the data of the received message to obtain the received check value, it also includes: performing cyclic redundancy check calculation on the message to be sent to obtain the original check value; setting the original check code at the beginning and / or end of the message to be sent; the sending controller sends the message to be sent, and the receiving controller is communicatively connected with the sending controller.
[0025] In a possible implementation, a frame of received message includes N signals. If each signal is tried M times, the number of repetitions of changing the mutation value is 1-Num times, where Num=M. N .
[0026] In a second aspect, the present invention provides a vehicle-mounted controller local area network data repair system, comprising: a sending controller, a receiving controller, a judgment module and a data repair module;
[0027] A sending controller, which is in communication with the receiving controller, is used to calculate a cyclic redundancy check code for the message to be sent, store the original check value, and send the message to be sent to the receiving controller;
[0028] A receiving controller receives a message to be sent from the sending controller, and performs cyclic redundancy check code calculation on data of the received message to obtain a receiving check value;
[0029] A judgment module, connected to the sending controller, the receiving controller and the data repair module, is used to judge whether the received check value and the repaired check value are the same as the original check value;
[0030] The data repair module is connected to the receiving controller and the judging module, and is used for receiving the judgment result of the judging module and performing signal trend analysis on the received message.
[0031] In a possible implementation, it also includes a marking module;
[0032] The marking module is in communication with the receiving controller and the data repair module, and is used to add a repair tag to the repair message.
[0033] In the third aspect, the present invention provides a vehicle-mounted controller local area network data repair device, characterized in that it includes: a processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor executes the computer instructions, the vehicle-mounted controller local area network data repair device executes the vehicle-mounted controller local area network data repair method as the first aspect and any possible implementation method thereof.
[0034] In a fourth aspect, the present invention provides an electronic device comprising: a processor, a storage medium and a computer program, wherein the computer program is stored in the storage medium and is characterized in that when the computer program is executed by the processor, the vehicle controller local area network data repair method of the first aspect and any possible implementation method thereof is implemented.
[0035] In a fifth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the vehicle-mounted controller local area network data repair method of the first aspect and any possible implementation method thereof is implemented.
[0036] For the specific description of the second to fifth aspects and their various implementations in the present invention, reference can be made to the detailed description in the first aspect and its various implementations; and for the beneficial effects of the second to fifth aspects and their various implementations, reference can be made to the analysis of the beneficial effects in the first aspect and its various implementations, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
[0038] Figure 1 It is a flow chart of a vehicle controller local area network data repair method provided by the present invention;
[0039] Figure 2 It is a structural schematic diagram of a vehicle-mounted controller local area network data repair device provided by the present invention;
[0040] Figure 3 It is another flow chart of a vehicle controller local area network data repair method provided by the present invention;
[0041] Figure 4 It is a structural schematic diagram of a vehicle-mounted controller local area network data repair system provided by the present invention;
[0042] 1-sending controller, 2-receiving controller, 3-judgment module, 4-data repair module, 5-marking module. DETAILED DESCRIPTION
[0043] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0044] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0045] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0046] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0047] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0048] The vehicle controller area network data repair method provided in the embodiment of the present invention is executed by a vehicle controller area network data repair system. The vehicle controller area network data repair system can be a computer device, which can be an electronic device or a server, or a central processing unit (CPU) in the electronic device or server.
[0049] Figure 2 A schematic diagram of the composition of a vehicle controller local area network data repair system provided by an embodiment of the present invention. Figure 2 As shown, the vehicle-mounted controller area network data repair system may include: at least one processor 11 , a memory 12 , a communication interface 13 and a communication bus 14 .
[0050] The processor 11 is the control center of the vehicle controller area network data repair system, which can be a CPU, a microprocessing unit, or one or more integrated circuits for controlling the execution of the program of the embodiment of the present invention.
[0051] As an embodiment, the processor 11 may include one or more CPUs, such as Figure 2Also, as an embodiment, the vehicle controller area network data repair system may include multiple processors, such as Figure 2 The processor 11 shown in FIG. The processor 11 may be a single-core processor (Single-CPU) or a multi-core processor (Multi-CPU).
[0052] The memory 12 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 12 may exist independently and be connected to the processor 11 via the communication bus 14. The memory 12 may also be integrated with the processor 11.
[0053] In a specific implementation, the memory 12 is used to store the data of the present invention and execute the software program of the present invention. The processor 11 can execute various functions of the vehicle controller area network data repair system by running or executing the software program stored in the memory 12 and calling the data stored in the memory 12.
[0054] The communication interface 13 uses any transceiver-like device for communicating with other devices or communication networks, such as radio access networks (RAN), wireless local area networks (WLAN), etc. The communication interface 13 may include a receiving unit 131 to implement a receiving function, and a sending unit 132 to implement a sending function.
[0055] The communication bus 14 may include a pathway for transmitting information between the above-mentioned components.
[0056] It should be pointed out that Figure 2 The structure shown in the figure does not constitute a limitation on the vehicle controller local area network data repair system, except Figure 2In addition to the components shown, the vehicle-mounted controller area network data repair system may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0057] Example 1
[0058] Based on the above introduction to the structure of the vehicle controller local area network data repair system, an embodiment of the present invention provides a vehicle controller local area network data repair method, such as Figure 1 As shown, the vehicle controller local area network data repair method may include the following steps:
[0059] S1: Calculate the cyclic redundancy check code of the received message data to obtain the received check value;
[0060] S2: Determine whether the received check value is the same as the original check value;
[0061] S3: If the check value is different from the original check value, data repair is performed on the received message, and the data repair includes S31: signal trend analysis;
[0062] S31: Signal trend analysis includes:
[0063] S311: traverse the data in the received message to locate the mutation value;
[0064] S312: Changing the mutation value, after changing the mutation value to a value close to the stable value, obtaining repair data, the stable value is a signal of the same type as the mutation value signal in other frame reception messages;
[0065] S313: Calculate a cyclic redundancy check code on the repair data to obtain a repair check value, and determine whether the repair check value is the same as the original check value;
[0066] S314: Repeat changing the mutation value until the repaired check value is the same as the original check value;
[0067] S315: Replace the received message containing the mutation value with the current repair data and store it to obtain a repair message.
[0068] Specifically, S1: Calculate the cyclic redundancy check code of the received message data to obtain the received check value; refer to Table 1
[0069] , This embodiment takes Table 1 as an example of CAN bus message data with CRC check as an example for illustrative explanation, performs CRC calculation on the data content of the received message again to obtain a received check value, step S2: determines whether the received check value is the same as the original check value, and compares the CRC result, that is, the received check value, with the received CRC (byte0), that is, the original check value; if the received check value is consistent with the original check value, the data of the received message is accurate and does not need to be repaired; S3: if the received check value is different from the original check value, the received message is repaired, indicating that the data has been tampered with and needs to be repaired, and the data repair includes S31: signal trend analysis;
[0070] S31: Signal trend analysis includes:
[0071] S311: traverse the data in the received message to locate the mutation value;
[0072] S312: Changing the mutation value, after changing the mutation value to a value close to the stable value, obtaining repair data, the stable value is a signal of the same type as the mutation value signal in other frame reception messages;
[0073] It should be noted that the message to be sent includes multiple different signals, so the signal in the received message corresponds to the signal in the message to be sent, and there should be multiple different signal types. The stable value is the signal of the same type as the mutation value signal in other frame received messages.
[0074] S313: Calculate a cyclic redundancy check code on the repair data to obtain a repair check value, and determine whether the repair check value is the same as the original check value;
[0075] S314: Repeat changing the mutation value until the repaired check value is the same as the original check value;
[0076] S315: Replace the received message containing the mutation value with the current repair data and store it to obtain a repair message.
[0077] For signals such as vehicle speed, rotation speed, voltage, and current, the value coverage range is large, and the range of attempts can be narrowed through step S31: signal trend analysis, because such signals generally do not change significantly in a short time (generally, the interval between two frames of messages is 10ms). Taking the signal voltage in Table 1 as an example, assuming that the signal is defined in the communication protocol as 0-25.5V, and the resolution is 0.1V (i.e., 1bit=0.1V), at a certain moment, a frame of messages to be sent continuously sent by the sending controller is 0x06 0x79 0x04 0x03 0x02 0x03 0x010x3d; and the three consecutive frames of messages before this frame of messages are:
[0078] 0x06 0x7a 0x04 0x03 0x02 0x03 0x01 0x14; (voltage=12.2V)
[0079] 0x06 0x7b 0x04 0x03 0x02 0x03 0x01 0x23; (voltage=12.3V)
[0080] 0x06 0x7c 0x04 0x03 0x02 0x03 0x01 0x59; (voltage=12.4V)
[0081] The receiving message received by receiving controller 2 is 0x06 0x09 0x04 0x03 0x02 0x03 0x010x3d; the receiving controller 2 calculates the CRC of the data of the received message and it is not 0x3d, triggering data repair. When judging the voltage, it is found that the voltages in the previous three frames of the message are 12.2V, 12.3V, and 12.4V respectively, and the value of the voltage signal in the current message suddenly changes to 0.9V, which is the mutation value. The mutation value generally refers to the signal of the same signal type in the received message, and the value is obviously different from the values of other signals of the same type. Such signals like voltage signals generally do not change suddenly. Therefore, the previously received value, that is, the value near the stable value, is tried to be changed. The closer the mutation value is to the last stable value received before, the greater the probability of its correctness. Therefore, the mutation value is modified to 12.4, 12.3, 12.5, 12.2, 12.6, 12.1... in sequence. When 12.1 is tried, the calculated check value is consistent with the original check value. The current repair data replaces the received message where the mutation value is located and is stored. The signal voltage is repaired and a repair message is obtained.
[0082] Table 1 CAN message table with cyclic redundancy check code
[0083] byte7 byte6 byte5 byte4 byte3 byte2 byte1 byte0 current voltage speed type mode status RollingCounter CRC
[0084] It should be noted that CRC calculation is also called cyclic redundancy check code calculation, which is a commonly used check code in the field of computer network communication. Cyclic redundancy check code includes a series of data encoding rules such as shift and division. Its algorithm principle, algorithm program design and analysis can all be solved through corresponding software coding. Cyclic redundancy check code is an algorithm that uses software for verification, so its verification speed is very fast, the bit error rate of verification is also low, and the information transmission speed of the entire computer network communication is very high.
[0085] It should be noted that the vehicle-mounted controller local area network data repair method provided by the present invention is also applicable to Ethernet data repair.
[0086] It can be understood that the present invention provides a method for repairing data of a vehicle controller local area network, including: if the received check value is different from the original check value, performing data repair on the received message, the data repair includes signal trend analysis, quickly locating the mutation value in the signal trend analysis, that is, the data that may be tampered with, and then trying to change the mutation value, after changing the mutation value to a value close to the stable value, obtaining the repair data, performing cyclic redundancy check code calculation on the repair data, and checking until the repair check value is the same as the original check value, completing the data repair. The method provided by the present invention can narrow the scope of data attempts during the data repair process, quickly find possible correct data, accelerate data analysis and repair of important signals, further improve the robustness of vehicle-mounted CAN communication, and prevent the controller from losing key signals due to communication interference.
[0087] Example 2
[0088] Referring to Table 1, this embodiment describes in detail step S32 of S3 data repair: rationality analysis based on Embodiment 1;
[0089] S32: Rationality analysis includes: S321: traversing the signals in the received message; S322: locating the suspicious signal through the definition range of each signal; S323: changing the suspicious signal, changing the suspicious signal to a new signal within the defined range, and obtaining a repair signal; S324: performing cyclic redundancy check code calculation on the repair signal to obtain a repair check value, and comparing the repair check value with the original check value; S325: repeatedly changing the suspicious signal until the repair check value is the same as the original check value; S326: replacing the received message where the suspicious signal is located with the current repair signal and storing it to obtain a repair message.
[0090] It should be noted that S32: rationality analysis, that is, when the signal of the received message is not within the defined range, after locating the suspicious signal, try to change the suspicious signal to a new signal within the defined range to obtain a repair signal, and calculate the CRC of the message composed of the repair signal again to obtain a repair check value; if the repair check value is consistent with the original check value, it means that the repair is successful, and the current repair signal replaces the message where the suspicious signal is located and is stored to obtain a repair message.
[0091] This embodiment is exemplified by the message definition in Table 1: for example, the sending controller sends a frame of message to be sent: 0x06 0x05 0x04 0x03 0x02 0x03 0x01 0xcc (0xcc is the CRC of byte1-byte7); and the receiving controller receives the receiving message 0x06 0x05 0x04 0x03 0x020x11 0x010xcc (the signal signal1 at byte2 is tampered with to 0x11); the receiving controller treats the data of the received message 0x06 0x05 0x04 0x03 0x02 The CRC calculated by 0x110x01 is not 0xcc, triggering data repair; the signal types of different bits in each message are different, so the definition range of the signal of each bit is different. If in the communication protocol, the definition range of the signal status is 0x01-0x07, and the received signal is 0x11, the receiving controller 2 concludes that the signal is a suspicious signal through rationality analysis, so the suspicious signal is modified to 0x01-0x07 in turn, and the CRC calculation is performed on the new message. When the suspicious signal is modified to 0x03, the CRC of the calculated message is 0xcc, which is consistent with the original check value. The repair is effective, and the signal status is successfully repaired to the correct value. The current repair signal replaces the received message where the suspicious signal is located and is stored to obtain a repaired message.
[0092] It should be noted that data repair includes S31: signal trend analysis and S32: rationality analysis. When selecting a data repair method, for signals such as vehicle speed, rotational speed, voltage, and current, the value coverage range is large. If S32: rationality analysis is used for data repair, multiple attempts are required, which will consume CPU running time. For such signals, S31: signal trend analysis can be used to narrow the scope of attempts. Therefore, S31: signal trend analysis is generally used to repair more important signals in more important messages, such as throttle pedal opening, brake signal, torque request, torque response, and high-level fault conditions (collision signal, insulation fault, high temperature fault), etc.
[0093] Example 3
[0094] refer to Figure 3 This embodiment describes in detail adding a repair tag to a repair message based on Embodiment 2, and after performing data repair on a received message, further includes S4: adding a repair tag to the repair message.
[0095] It should be noted that when the repair check value is consistent with the original check value, after step S3 is completed, it can be determined that the data of the repair message has a certain degree of credibility. However, from the perspective of data security, a "repair" label is added to the data of the repair message. The marking module 5 adds a marking point to the repair data during the data repair process of the data repair module 4, thereby transmitting a "reduced credibility" signal to the logical unit that uses the signal in this frame to receive the message. This marking point can be a variable. When the repair message is applied later, the application layer can recognize this marking point. Without affecting the operation of the entire vehicle, the credibility of the repair data is reduced to improve safety.
[0096] Example 4
[0097] This embodiment describes in detail a vehicle controller local area network data repair method provided by the present invention on the basis of embodiment 3. Figure 3 , before S1: calculating the cyclic redundancy check code for the data of the received message to obtain the received check value, it also includes: S01: calculating the cyclic redundancy check code for the message to be sent to obtain the original check value; S02: setting the original check code at the beginning and / or end of the message to be sent; S03: the sending controller 1 sends the message to be sent, and the receiving controller 2 is connected to the sending controller 1 for communication.
[0098] It should be noted that before S1: calculating the cyclic redundancy check code for the data of the received message to obtain the received check value, it also includes: S01: calculating the cyclic redundancy check code for the message to be sent to obtain the original check value; S02: setting the original check code at the beginning and / or end of the message to be sent; so that after the message to be sent is sent, the received check value and the repaired check value can be compared with the original check value; S03: the sending controller 1 sends the message to be sent, and the receiving controller 2 is communicated with the sending controller 1.
[0099] Example 5
[0100] This embodiment describes S311: signal trend analysis in detail based on Embodiment 4:
[0101] A frame of received message includes N signals. If each signal is tried M times, the number of repetitions of changing the mutation value is 1-Num times, where Num = M N .
[0102] It should be noted that since a received message contains N signals, if each signal is tried M times, the number of repetitions for changing the mutation value is 1-Num times, Num = M NIf the signal and value range of a frame of received message is relatively large, it will consume a lot of CPU time. Therefore, signal trend analysis is generally used to repair more important signals in more important messages, such as accelerator pedal opening, brake signal, torque request, torque response and high-level fault status (collision signal, insulation fault, high temperature fault).
[0103] Embodiment 6,
[0104] The present invention provides a vehicle-mounted controller local area network data repair system, which is applied to the vehicle-mounted controller local area network data repair method described in any one of the above-mentioned embodiments 1 to 5, comprising:
[0105] Sending controller 1, receiving controller 2, judging module 3 and data repairing module 4;
[0106] The sending controller 1 is connected to the receiving controller 2 for communication, and is used for calculating the cyclic redundancy check code of the message to be sent, storing the original check value, and sending the message to be sent to the receiving controller 2;
[0107] The receiving controller 2 receives the message to be sent from the sending controller 1, and performs cyclic redundancy check code calculation on the data of the received message to obtain a receiving check value;
[0108] The judgment module 3 is connected to the sending controller 1, the receiving controller 2 and the data repair module 4, and is used to judge whether the received check value and the repaired check value are the same as the original check value;
[0109] The data repair module 4 is connected to the receiving controller 2 and the judging module 3, and is used for receiving the judgment result of the judging module 3 and performing signal trend analysis on the received message.
[0110] Also includes a marking module 5;
[0111] The marking module 5 is in communication with the receiving controller 2 and the data repair module 4 and is used to add a repair tag to the repair message.
[0112] Specifically, the present invention provides a vehicle-mounted controller local area network data repair system, comprising: a sending controller 1, a receiving controller 2, a judgment module 3 and a data repair module 4;
[0113] The sending controller 1 and the receiving controller 2 belong to the vehicle-mounted CAN controller. The CAN bus is a serial data communication bus developed to solve the data exchange between many measurement and control components in modern automobiles. The sending controller 1 and the receiving controller 2 can provide a data transmission rate of up to 1Mbit / s, which makes real-time control very easy, can improve the data transmission speed and enhance controllability; the sending buffer of the sending controller 1 can store complete standard or extended messages. When the main microprocessor requires SJA1000 to send a message, the interface management logic manipulates the CAN core module to send the message in the sending buffer to the CAN bus; when receiving a message, the CAN core module first converts the serial bit stream data on the bus into bit parallel data, and then passes it to the receiving filter module for identification to determine whether the message is the message category required by the main microprocessor. All received messages can be stored in the receiving first-in-first-out queue. After receiving the message, the receiving controller 2 performs CRC calculation verification to determine whether the data has been tampered with, thereby improving security.
[0114] The judgment module 3 is connected to the sending controller 1, the receiving controller 2 and the data repair module 4, and judges the received check value and the original check value to determine whether step S3 is needed. During the S3 data repair process, the judgment module 3 works at high speed to judge whether the repaired check value is the same as the original check value, which can significantly improve the data repair efficiency. ;
[0115] The data repair module 4 receives the judgment result of the judgment module 3, and repairs the data that has been tampered with during the transmission process. Even if the transmitted data is damaged, it is still possible to repair it, thereby avoiding data loss. It can prevent the controller from losing very critical signals due to communication interference, such as collision status, accelerator pedal signal, brake signal, etc., thereby increasing the robustness of the vehicle-mounted controller local area network data repair system provided by the present invention.
[0116] Also includes a marking module 5;
[0117] The marking module 5 is communicatively connected with the receiving controller 2 and the data repair module 4. During the data repair process performed by the data repair module 4, a repair tag is added to the repair message, and a marking point is added to the repair data, so as to transmit a "reduced credibility" signal to the logical unit using the signal in this frame of the received message. This marking point can be a variable. When the repair message is applied later, the application layer can recognize this marking point, and the credibility of the repair data can be reduced without affecting the operation of the entire vehicle, thereby improving safety.
[0118] It can be understood that the vehicle-mounted controller local area network data repair system provided by the present invention includes a sending controller 1, a receiving controller 2, a judgment module 3 and a data repair module 4. The sending controller 1 is connected to the receiving controller 2 to transmit and receive messages, calculate the data of the received message, and judge whether the data has been tampered with during the transmission process and whether data repair is required; the judgment module 3 is used to compare the received verification value and the repaired verification value with the original verification value; the data repair module 4 is used to perform data repair to further improve the robustness and security of the vehicle-mounted CAN communication.
[0119] Example 7
[0120] The present invention provides a vehicle-mounted controller local area network data repair device, comprising: a processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor executes the computer instructions, the vehicle-mounted controller local area network data repair device executes the vehicle-mounted controller local area network data repair method as described in any one of Examples 1 to 5.
[0121] Example 8
[0122] The present invention provides an electronic device, including: a processor, a storage medium and a computer program, wherein the computer program is stored in the storage medium, and is characterized in that when the computer program is executed by the processor, the embodiments 1-
[0123] The vehicle controller local area network data repair method described in any one of Example 5.
[0124] Example 8
[0125] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the embodiments 1-
[0126] The vehicle controller local area network data repair method described in any one of Example 5.
[0127] It can be seen from the above embodiments that the vehicle controller local area network data repair method and system provided by the present invention achieve at least the following beneficial effects:
[0128] The present invention provides a method and system for repairing data of a vehicle-mounted controller local area network. The method comprises: if a received check value is different from an original check value, data repair is performed on the received message, the data repair comprises signal trend analysis, a mutation value is quickly located in the signal trend analysis, that is, data that may be tampered with, and then an attempt is made to change the mutation value, after the mutation value is changed to a value close to a stable value, repair data is obtained, a cyclic redundancy check code is calculated for the repair data, and the repair is verified until the repair check value is the same as the original check value, and the data repair is completed, and a marking module adds a repair tag to the repair message after the data repair to increase security; the method provided by the present invention can narrow the scope of data attempts during the data repair process, and quickly Finding possible correct data, accelerating data analysis and repair of important signals, further improving the robustness of vehicle-mounted CAN communication, and preventing the controller from losing key signals due to communication interference. The vehicle-mounted controller local area network data repair system provided by the present invention includes a sending controller, a receiving controller, a judgment module and a data repair module. The sending controller is connected to the receiving controller to transmit and receive messages, calculate the data of the received message, and judge whether the data has been tampered with during the transmission process and whether data repair is needed; the judgment module is used to compare the check value with the original check value; the data repair module is used to repair the data, thereby further improving the robustness and security of vehicle-mounted CAN communication.
[0129] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will be appreciated by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A method for repairing data of a vehicle controller local area network, characterized in that: include: Calculate the cyclic redundancy check code of the received message data to obtain the received check value; Determining whether the received check value is the same as the original check value; If the received check value is different from the original check value, performing data repair on the received message, wherein the data repair includes signal trend analysis; The signal trend analysis includes: Traversing the data in the received message to locate the mutation value; The mutation value is changed, and repair data is obtained after the mutation value is changed to a value close to a stable value, wherein the stable value is a signal of the same signal type as the mutation value in the received message of other frames; Performing cyclic redundancy check code calculation on the repair data to obtain a repair check value, and determining whether the repair check value is the same as the original check value; Repeating the changing of the mutation value until the repaired check value is the same as the original check value; The received message containing the mutation value is replaced by the current repair data and stored to obtain a repair message.
2. The vehicle controller local area network data repair method according to claim 1, characterized in that: The data repair also includes rationality analysis, which includes: traversing the signals in the received message; locating suspicious signals through the definition range of each signal; changing the suspicious signal, changing the suspicious signal to a new signal within the defined range, and obtaining a repair signal; performing cyclic redundancy check code calculation on the repair signal to obtain the repair check value, and comparing the repair check value with the original check value; repeatedly changing the suspicious signal until the repair check value is the same as the original check value; replacing the received message where the suspicious signal is located with the current repair signal and storing it to obtain the repair message.
3. The vehicle controller local area network data repair method according to claim 1, characterized in that: After performing data repair on the received message, the method further includes adding a repair tag to the repair message.
4. The vehicle controller local area network data repair method according to claim 1, characterized in that: Before the cyclic redundancy check code is calculated for the data of the received message to obtain the received check value, it also includes: calculating the cyclic redundancy check code for the message to be sent to obtain the original check value; setting the original check value at the beginning and / or end of the message to be sent; the sending controller sends the message to be sent, and the receiving controller is communicatively connected with the sending controller.
5. The vehicle controller local area network data repair method according to claim 1, characterized in that: A frame of the received message includes N signals, N is a positive integer greater than or equal to 1. If each signal is tried M times, M is a positive integer greater than or equal to 1, then the number of repetitions of repeatedly changing the mutation value is 1-Num times, where Num=M N , Num is a positive integer greater than or equal to 1.
6. A vehicle-mounted controller local area network data repair system, characterized in that: include: Sending controller, receiving controller, judgment module and data repair module; The sending controller is connected to the receiving controller for performing cyclic redundancy check code calculation on the message to be sent, storing the original check value and sending the message to be sent to the receiving controller; The receiving controller receives the message to be sent sent by the sending controller, and performs cyclic redundancy check code calculation on the data of the received message to obtain a receiving check value; A judgment module, connected to the sending controller, the receiving controller and the data repair module, and used to judge whether the received check value and the repaired check value are the same as the original check value; The data repair module is connected to the receiving controller and the judging module, and is used for receiving the judging result of the judging module and performing signal trend analysis on the received message.
7. The vehicle controller local area network data repair system according to claim 6, characterized in that: Also includes a tagging module; The marking module is in communication with the receiving controller and the data repair module, and is used to add a repair tag to the repair message.
8. A vehicle-mounted controller local area network data repair device, characterized in that: include: A processor and a memory, wherein the memory is used to store computer program codes, the computer program codes include computer instructions, and when the processor executes the computer instructions, the vehicle controller local area network data repair device executes the vehicle controller local area network data repair method as described in any one of claims 1-5.
9. An electronic device, comprising: A processor, a storage medium and a computer program, wherein the computer program is stored in the storage medium, and is characterized in that when the computer program is executed by the processor, the vehicle controller local area network data repair method described in any one of claims 1 to 5 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the vehicle controller local area network data repair method described in any one of claims 1 to 5 is implemented.
