A method and system for automotive communication compatible with dbc
By defining the DBCE format and combining it with the Base64 algorithm, the shortcomings of the DBC format in automotive communication are addressed, achieving improvements in flexibility, scalability, and security, and supporting UDS parsing, complex calculations, and secure data transmission.
Patent Information
- Application Number
- CN202310852077.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-07-12
AI Technical Summary
The existing DBC format has several limitations in automotive communication, including lack of support for UDS parsing, insufficient basic computational capabilities, lack of support for ASCII code conversion, inability to save variable test data, low parsing efficiency, and insufficient security.
Define the DBCE format, add signal type, logic script and feature value, generate DBCE file based on DBC format, and use Base64 algorithm for encrypted transmission and decryption parsing. Support UDS parsing, complex calculation, ASCII code conversion, variable test data storage and logical judgment to avoid plaintext theft.
It enhances the flexibility, scalability, efficiency, and security of automotive communications, supporting more complex data processing and secure transmission.
Smart Images

Figure CN116980249B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of automobile communication technology, and particularly discloses a kind of compatible DBC automobile communication method and system. BACKGROUND
[0002] DBC (Database Can) is a CAN network communication file format defined by vector company, which represents the CAN database file, and DBC defines the CAN communication information very completely, and the CAN network communication is carried out according to the description of DBC, and it is just because of DBC that the node controller of the whole CAN network can be developed without error.
[0003] However, the traditional DBC has the following problems: 1. It does not support UDS (Unified Diagnostic Services) analysis; 2. It only supports simple calculation on uploaded values, such as V (uploaded value) * F (coefficient) + O (offset); 3. It does not support encoding conversion functions such as ACSII code conversion; 4. It can only analyze the data returned by CAN or CANFD in real time, and cannot save the maximum value, minimum value, average value and other signals during the variable test process; 5. It can only perform data analysis according to the protocol rigidly, and cannot perform some logical judgments; 6. All data in the file are analyzed during analysis, resulting in low efficiency, because some data such as heartbeat data do not need to be analyzed; 7. The DBC file is saved in plaintext form, and the security is low.
[0004] Due to the above problems of DBC, it cannot be completely applied in automobile communication, because automobile communication not only exists simple data transmission, but also exists UDS transmission, and some data needs to be calculated or analyzed twice after uploading, such as NTC temperature value, ACSII code, etc., and it takes a lot of time to develop based on the uploaded data and there is a high degree of repetitive work.
[0005] Therefore, how to provide a kind of compatible DBC automobile communication method and system to realize the flexibility, expandability, efficiency and security of automobile communication has become a technical problem to be solved. SUMMARY
[0006] The technical problem to be solved by the present application is to provide a kind of compatible DBC automobile communication method and system to realize the flexibility, expandability, efficiency and security of automobile communication.
[0007] In a first aspect, the present application provides a kind of compatible DBC automobile communication method, comprising the following steps:
[0008] Step S10, defining DBCE format based on DBC format;
[0009] Step S20, when communicating, the sending end generates DBCE file based on the DBCE format and the CAN message to be transmitted, and sends the DBCE file to the receiving end after encryption by Base64 algorithm.
[0010] Step S30, the receiving end decrypts the received DBCE file by Base64 algorithm, and then analyzes the DBCE file in real time based on the DBCE format, thereby completing the vehicle communication.
[0011] Further, the step S10 specifically comprises:
[0012] The DBCE format is defined by adding signal type, logic script and characteristic value based on the DBC format.
[0013] Further, the signal type has values of 0, 1, 2, 3 and 4; 0 represents heartbeat data and does not need to be parsed; 1 represents normal data and needs to be parsed; 2 represents that the characteristic value needs to be updated; 3 represents that logic processing needs to be performed; and 4 represents that ACSII data decoding needs to be performed.
[0014] The logic script carries a script for processing UDS.
[0015] The characteristic value includes characteristic maximum value, characteristic minimum value and characteristic average value.
[0016] Further, in the step S30, the real-time analysis of the DBCE file based on the DBCE format specifically comprises:
[0017] Extracting signal type, logic script, characteristic value and CAN message from the DBCE file, and judging the value of the signal type.
[0018] When the value of the signal type is 0, the CAN message is not parsed.
[0019] When the value of the signal type is 1, N byte data of the CAN message is combined in order, each byte data is sequentially moved N*byte serial number bits to the right, and then added to obtain byte sequence; when the value of the byte sequence is 0, it indicates that the format of the CAN message is Motorola format, with low byte first and high byte last; when the value of the byte sequence is 1, it indicates that the format of the CAN message is Intel format, with high byte first and low byte last.
[0020] The starting bit and the termination bit are calculated based on the starting bit and the bit length carried by the CAN message, the effective data is extracted by using the starting bit and the termination bit, the right shift number is calculated based on the bit length, the original data is obtained by right shifting the effective data based on the right shift number and masking the high bit;
[0021] After the original data is converted into a decimal number, the message data is obtained by multiplying the original data by a scale factor and adding an offset;
[0022] When the value of the signal type is 2, the CAN message is first parsed to obtain message data, the feature maximum value and the feature minimum value in the feature value are updated based on the message data, the number of times of updating the feature value is accumulated during the updating process, the values of the feature maximum value and the feature minimum value are accumulated to obtain a feature total value, and the feature average value is updated based on the value of the feature total value divided by the number of times of updating.
[0023] When the value of the signal type is 3, the CAN message is executed based on the logic script.
[0024] When the value of the signal type is 4, each byte data of the CAN message is converted into a character based on the ASCII code table and spliced.
[0025] Further, after the CAN message is parsed to obtain message data, the message data is updated based on the message maximum value and the message minimum value carried by the DBC format.
[0026] In a second aspect, the application provides an automobile communication system compatible with DBC, comprising the following modules:
[0027] A DBCE format definition module is configured to define the DBCE format based on the DBC format.
[0028] A DBCE file generation and sending module is configured to generate a DBCE file based on the DBCE format and a CAN message to be transmitted when the automobile communicates, and to send the DBCE file to a receiving end after the DBCE file is encrypted by using a Base64 algorithm.
[0029] A DBCE file receiving and parsing module is configured to decrypt the received DBCE file by using a Base64 algorithm, to parse the DBCE file in real time based on the DBCE format, and to complete automobile communication.
[0030] Further, the DBCE format definition module is specifically configured to:
[0031] The DBCE format is defined as adding a signal type, a logic script and a feature value based on the DBC format.
[0032] Further, the signal type has values of 0, 1, 2, 3, 4; 0 represents heartbeat data, which does not need to be parsed; 1 represents normal data, which needs to be parsed; 2 represents that a characteristic value needs to be updated; 3 represents that logical processing needs to be performed; and 4 represents that ACSII data decoding needs to be performed.
[0033] The logic script carries a script for processing the UDS.
[0034] The characteristic value includes a characteristic maximum value, a characteristic minimum value, and a characteristic average value.
[0035] Further, in the DBCE file receiving and parsing module, the real-time parsing of the DBCE file based on the DBCE format specifically includes:
[0036] The signal type, the logic script, the characteristic value, and the CAN message are extracted from the DBCE file, and the value of the signal type is determined.
[0037] When the value of the signal type is 0, the CAN message is not parsed.
[0038] When the value of the signal type is 1, N byte data of the CAN message are combined in order, each byte data is sequentially moved N*byte serial number bits to the right, and then added to obtain a byte sequence; when the value of the byte sequence is 0, it indicates that the format of the CAN message is a Motorola format, with low bytes in front and high bytes in back; when the value of the byte sequence is 1, it indicates that the format of the CAN message is an Intel format, with high bytes in front and low bytes in back.
[0039] Based on the start bit and the bit length carried by the CAN message, a termination bit is calculated, the effective data is extracted by using the start bit and the termination bit, the right shift number is calculated based on the bit length, the effective data is right shifted based on the right shift number, and the high bits are shielded to obtain original data.
[0040] After the original data is converted into a decimal number, the message data is obtained by multiplying the decimal number by a proportion factor and adding an offset.
[0041] When the value of the signal type is 2, the CAN message is first parsed to obtain message data, the characteristic maximum value and the characteristic minimum value in the characteristic value are updated based on the message data, the number of times of updating the characteristic value is accumulated during the updating process, the values of the characteristic maximum value and the characteristic minimum value are accumulated to obtain a characteristic total value, and the characteristic average value is updated based on the value of the characteristic total value divided by the number of times of updating.
[0042] When the value of the signal type is 3, the CAN message is executed based on the logic script.
[0043] When the value of the signal type is 4, each byte data of the CAN message is converted into a character based on an ACSII code table and spliced in sequence.
[0044] Further, after the CAN message is parsed to obtain message data, the message data is updated based on the maximum value and the minimum value of the message carried by the DBC format.
[0045] The application has the advantages that:
[0046] The DBCE format is defined based on the DBC format, that is, the signal type, the logic script and the characteristic value are added based on the DBC format, the DBCE file is generated based on the DBCE format and the CAN message to be transmitted, and the DBCE file is encrypted by using the Base64 algorithm; after the DBCE file is decrypted by using the Base64 algorithm at the receiving end, the DBCE file is parsed in real time based on the DBCE format, that is, different parsing operations are performed based on different values of the signal type, so that the DBCE format supports the parsing of UDS, supports more complex calculation, supports the conversion of ACSII code to character, supports the saving of the maximum value, the minimum value and the average value in the variable test process, supports some logical judgment, supports the non-parsing of heartbeat data, avoids the DBCE file from being stolen in plaintext by combining the Base64 algorithm, and finally greatly improves the flexibility, expandability, efficiency and security of automobile communication. BRIEF DESCRIPTION OF DRAWINGS
[0047] The application will be further described below with reference to the drawings and embodiments.
[0048] Fig. 1 is a flowchart of a DBC-compatible automobile communication method of the application.
[0049] Fig. 2 is a structural schematic diagram of a DBC-compatible automobile communication system of the application. DETAILED DESCRIPTION
[0050] The technical solution in the embodiments of the application has the following general idea: the DBCE format is defined based on the DBC format, that is, the signal type, the logic script and the characteristic value are added based on the DBC format, so that the DBCE format supports the parsing of UDS, supports more complex calculation, supports the conversion of ACSII code to character, supports the saving of the maximum value, the minimum value and the average value in the variable test process, supports some logical judgment, supports the non-parsing of heartbeat data, the file is encrypted by combining the Base64 algorithm, and thus the flexibility, expandability, efficiency and security of automobile communication are improved.
[0051] Please refer to Figs. 1-2As shown, a preferred embodiment of the application is compatible with the automobile communication method of DBC, comprising the following steps:
[0052] Step S10, defining DBCE format based on DBC format;
[0053] Step S20, when communicating, the sending end generates DBCE file based on the DBCE format and the CAN message to be transmitted, and sends the DBCE file after encryption by Base64 algorithm to the receiving end, so as to avoid data being stolen in plaintext and improve security; the CAN message carries at least message ID, node name, message name, data type, start bit (StartBit), bit length (SignalSize), offset, scale factor and analysis type;
[0054] Step S30, the receiving end decrypts the received DBCE file by Base64 algorithm, and then performs real-time analysis on the DBCE file based on the DBCE format, thereby completing automobile communication.
[0055] The step S10 specifically comprises:
[0056] The defined DBCE format is based on DBC format, and signal type (SignalName), logic script (Script) and characteristic value (CharacteristicValue) are added.
[0057] The signal type takes values of 0, 1, 2, 3 and 4; 0 represents heartbeat data and does not need to be analyzed; 1 represents normal data and needs to be analyzed; 2 represents that the characteristic value needs to be updated; 3 represents that logic processing needs to be performed; and 4 represents that ACSII data decoding needs to be performed.
[0058] The logic script carries a script for processing UDS;
[0059] The characteristic value includes characteristic maximum value, characteristic minimum value and characteristic average value.
[0060] That is, the application extends UDS protocol and self-defined logic script and other formats on the basis of the original DBC file analysis method, applies different analysis methods to different formats of data, defines the file suffix generated by the extended method as.dbce, and the traditional.dbc file can also be directly read; for the DBCE file, it can also be separated by decomposition operation to generate a DBC file.
[0061] In the step S30, the real-time analysis of the DBCE file based on the DBCE format specifically comprises:
[0062] Extracting signal type, logic script, characteristic value and CAN message from the DBCE file, judging the value of the signal type;
[0063] When the value of the signal type is 0, the CAN message is not parsed;
[0064] When the value of the signal type is 1, N byte data of the CAN message is combined in order, each byte data is sequentially moved right by N*byte serial number bits, and then added to obtain byte order (ByteOrder), when the value of the byte order is 0, it indicates that the format of the CAN message is Motorola format, and low byte is in front and high byte is in back; when the value of the byte order is 1, it indicates that the format of the CAN message is Intel format, and high byte is in front and low byte is in back;
[0065] Based on the start bit and bit length carried by the CAN message, the end bit is calculated, the valid data is extracted by using the start bit and the end bit, the right shift number is calculated based on the bit length, the valid data is right shifted based on the right shift number, and the high bit is shielded to obtain the original data;
[0066] After the original data is converted into a decimal number, it is multiplied by a proportion factor (Factor) and added by an offset (Offset) to obtain message data;
[0067] When the value of the signal type is 2, the CAN message is parsed to obtain message data, the characteristic maximum value and the characteristic minimum value in the characteristic value are updated based on the message data, the update times of the characteristic value are accumulated during the updating process, the values of the characteristic maximum value and the characteristic minimum value are accumulated to obtain a characteristic total value, and the characteristic average value is updated based on the value of the characteristic total value divided by the update times.
[0068] When the value of the signal type is 3, the CAN message is executed based on the logic script.
[0069] When the value of the signal type is 4, each byte data of the CAN message is converted into a character based on the ACSII code table and spliced.
[0070] After the CAN message is parsed to obtain message data, the message data is updated based on the message maximum value (Max) and the message minimum value (Min) carried by the DBC format; that is, when the message data is greater than the message maximum value, the message data is updated based on the message maximum value; and when the message data is less than the message minimum value, the message data is updated based on the message minimum value.
[0071] A preferred embodiment of the automobile communication system compatible with DBC, comprising the following modules:
[0072] A DBCE format definition module is configured to define the DBCE format based on the DBC format;
[0073] A DBCE file generation and sending module is configured to generate a DBCE file based on the DBCE format and a CAN message to be transmitted when the automobile communicates, and send the DBCE file to a receiving end after the DBCE file is encrypted by using a Base64 algorithm, so as to avoid data from being stolen in plaintext and improve security; the CAN message carries at least a message ID, a node name, a message name, a data type, a start bit (StartBit), a bit length (SignalSize), an offset, a proportion coefficient and an analysis type;
[0074] A DBCE file receiving and analyzing module is configured to decrypt the received DBCE file by using the Base64 algorithm, analyze the DBCE file in real time based on the DBCE format, and then complete automobile communication.
[0075] The DBCE format definition module is specifically configured to:
[0076] The DBCE format is defined as the DBC format, and the signal type (SignalName), the logic script (Script) and the characteristic value (CharacteristicValue) are added.
[0077] The signal type takes values of 0, 1, 2, 3 and 4; 0 represents heartbeat data and does not need to be analyzed; 1 represents normal data and needs to be analyzed; 2 represents that the characteristic value needs to be updated; 3 represents that logic processing needs to be performed; and 4 represents that ACSII data decoding needs to be performed.
[0078] The logic script carries a script for processing UDS.
[0079] The characteristic value includes a characteristic maximum value, a characteristic minimum value and a characteristic average value.
[0080] That is, the present application extends the UDS protocol and the self-defined logic script and other formats on the basis of the original DBC file analysis method, applies different analysis methods to data in different formats, defines the file suffix generated by the extended method as.dbce, and the traditional.dbc file can also be directly read; for the DBCE file, the DBC part contained in the DBCE file can also be separated out to generate a DBC file.
[0081] In the DBCE file receiving and analyzing module, the real-time analysis of the DBCE file based on the DBCE format is specifically:
[0082] Extracting signal type, logic script, characteristic value and CAN message from the DBCE file, judging the value of the signal type;
[0083] When the value of the signal type is 0, the CAN message is not parsed;
[0084] When the value of the signal type is 1, N byte data of the CAN message are combined in sequence, each byte data is sequentially moved right by N*byte serial number bits, and then added to obtain byte order (ByteOrder), when the value of the byte order is 0, it indicates that the format of the CAN message is Motorola format, and low byte is in front and high byte is in back; when the value of the byte order is 1, it indicates that the format of the CAN message is Intel format, and high byte is in front and low byte is in back;
[0085] Based on the start bit and bit length carried by the CAN message, the end bit is calculated, the valid data is extracted by using the start bit and the end bit, the right shift number is calculated based on the bit length, the valid data is right shifted based on the right shift number, and the high bit is shielded to obtain the original data;
[0086] After the original data is converted into a decimal number, multiplied by a proportion factor (Factor) and added by an offset (Offset), the message data is obtained;
[0087] When the value of the signal type is 2, the CAN message is parsed to obtain message data, the characteristic maximum value and the characteristic minimum value in the characteristic value are updated based on the message data, the update times of the characteristic value are accumulated during the updating process, the values of the characteristic maximum value and the characteristic minimum value are accumulated to obtain a characteristic total value, and the characteristic average value is updated based on the value of the characteristic total value divided by the update times.
[0088] When the value of the signal type is 3, the CAN message is executed based on the logic script.
[0089] When the value of the signal type is 4, each byte data of the CAN message is converted into a character based on an ACSII code table and spliced.
[0090] After the CAN message is parsed to obtain message data, the message data is updated based on the message maximum value (Max) and the message minimum value (Min) carried by the DBC format; that is, when the message data is greater than the message maximum value, the message data is updated based on the message maximum value; and when the message data is less than the message minimum value, the message data is updated based on the message minimum value.
[0091] In summary, the advantages of the present application are:
[0092] By defining the DBCE format based on the DBC format, that is, adding signal types, logic scripts and characteristic values on the basis of the DBC format, generating a DBCE file based on the DBCE format and the CAN message to be transmitted, and transmitting the DBCE file by using the Base64 algorithm, the receiving end decrypts the DBCE file by using the Base64 algorithm, and performs real-time analysis on the DBCE file based on the DBCE format, that is, performing different analysis operations based on different values of the signal types, so that the DBCE format supports the analysis of UDS, supports more complex calculations, supports the conversion of ASCII codes to characters, supports saving the maximum value, the minimum value and the average value in the variable test process, supports some logical judgments, supports not analyzing the heartbeat data, avoids the DBCE file being stolen in plaintext by combining the Base64 algorithm, and finally greatly improves the flexibility, expandability, efficiency and security of automobile communication.
[0093] Although the specific embodiments of the present application are described above, those skilled in the art should understand that the specific examples described are only illustrative, and are not intended to limit the scope of the present application, and equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present application should be covered within the scope of the claims of the present application.
Claims
1. A vehicle communication method compatible with DBC, characterized in that: Includes the following steps: Step S10: Define the DBCE format as the DBC format with the addition of signal type, logic script, and feature value; the signal type has values of 0, 1, 2, 3, and 4; 0 represents heartbeat data, which does not need to be parsed; 1 represents ordinary data, which needs to be parsed; 2 represents feature value that needs to be updated. 3 indicates that logical processing is required; 4 indicates that ACSI data decoding is required; The logic script carries a script for processing the UDS; The feature values include the maximum feature value, the minimum feature value, and the average feature value; Step S20: During vehicle communication, the sending end generates a DBCE file based on the DBCE format and the CAN message to be transmitted, encrypts the DBCE file using the Base64 algorithm, and then sends it to the receiving end. Step S30: After decrypting the received DBCE file using the Base64 algorithm, the receiving end performs real-time parsing of the DBCE file based on the DBCE format, thereby completing vehicle communication.
2. The DBC-compatible vehicle communication method as described in claim 1, characterized in that: In step S30, the real-time parsing of the DBCE file based on the DBCE format specifically involves: Extract the signal type, logic script, feature value, and CAN message from the DBCE file, and determine the value of the signal type. When the value of the signal type is 0, the CAN message is not parsed; When the signal type value is 1, the N bytes of data in the CAN message are combined sequentially. Each byte is shifted to the right by N * byte sequence number positions from the least significant byte to the most significant byte, and then added together to obtain the byte order. When the byte order value is 0, it indicates that the CAN message format is Motorola format, with the least significant byte first and the most significant byte last. When the byte order value is 1, it indicates that the CAN message format is Intel format, with the most significant byte first and the least significant byte last. The stop bit is calculated based on the start bit and bit length carried in the CAN message. The valid data is extracted using the start bit and stop bit. The number of right shift bits is calculated based on the bit length. The valid data is then right-shifted based on the number of right shift bits, and the high bits are masked to obtain the original data. After converting the original data into a decimal number, multiplying it by a scaling factor and adding an offset, the message data is obtained. When the signal type is 2, the CAN message is first parsed to obtain the message data. Based on the message data, the maximum and minimum feature values in the feature values are updated. During the update process, the number of updates of the feature values is accumulated. The values of the maximum and minimum feature values are accumulated to obtain the total feature value. The feature average value is updated based on the total feature value divided by the number of updates. When the signal type is 3, logical processing is performed on the CAN message based on the logic script. When the signal type is 4, the byte data of the CAN message is converted into characters sequentially and concatenated based on the ACSII code table.
3. The DBC-compatible vehicle communication method as described in claim 2, characterized in that: After parsing the CAN message to obtain the message data, the message data is updated based on the maximum and minimum message values carried in the DBC format.
4. A DBC-compatible automotive communication system, characterized in that: Includes the following modules: The DBCE format definition module is used to define the DBCE format as an additional signal type, logic script, and feature value based on the DBC format. The signal type value is 0, 1, 2, 3, or 4; 0 represents heartbeat data, which does not need to be parsed; 1 represents ordinary data, which needs to be parsed; and 2 represents feature value that needs to be updated. 3 indicates that logical processing is required; 4 indicates that ACSI data decoding is required; The logic script carries a script for processing the UDS; The feature values include the maximum feature value, the minimum feature value, and the average feature value; The DBCE file generation and transmission module is used in vehicle communication. The transmitting end generates a DBCE file based on the DBCE format and the CAN message to be transmitted, encrypts the DBCE file using the Base64 algorithm, and then sends it to the receiving end. The DBCE file receiving and parsing module is used by the receiving end to decrypt the received DBCE file using the Base64 algorithm, and then parse the DBCE file in real time based on the DBCE format to complete vehicle communication.
5. A DBC-compatible automotive communication system as described in claim 4, characterized in that: In the DBCE file receiving and parsing module, the real-time parsing of the DBCE file based on the DBCE format specifically includes: Extract the signal type, logic script, feature value, and CAN message from the DBCE file, and determine the value of the signal type. When the value of the signal type is 0, the CAN message is not parsed; When the signal type value is 1, the N bytes of data in the CAN message are combined sequentially. Each byte is shifted to the right by N * byte sequence number positions from the least significant byte to the most significant byte, and then added together to obtain the byte order. When the byte order value is 0, it indicates that the CAN message format is Motorola format, with the least significant byte first and the most significant byte last. When the byte order value is 1, it indicates that the CAN message format is Intel format, with the most significant byte first and the least significant byte last. The stop bit is calculated based on the start bit and bit length carried in the CAN message. The valid data is extracted using the start bit and stop bit. The number of right shift bits is calculated based on the bit length. The valid data is then right-shifted based on the number of right shift bits, and the high bits are masked to obtain the original data. After converting the original data into a decimal number, multiplying it by a scaling factor and adding an offset, the message data is obtained. When the signal type is 2, the CAN message is first parsed to obtain the message data. Based on the message data, the maximum and minimum feature values in the feature values are updated. During the update process, the number of updates of the feature values is accumulated. The values of the maximum and minimum feature values are accumulated to obtain the total feature value. The feature average value is updated based on the total feature value divided by the number of updates. When the signal type is 3, logical processing is performed on the CAN message based on the logic script. When the signal type is 4, the byte data of the CAN message is converted into characters sequentially and concatenated based on the ACSII code table.
6. A DBC-compatible automotive communication system as described in claim 5, characterized in that: After parsing the CAN message to obtain the message data, the message data is updated based on the maximum and minimum message values carried in the DBC format.
Citation Information
Patent Citations
DBC file parsing and message analyzing method based on regular expression
CN108600192A
Automobile message storage method and device and automobile message storage system
CN113645287A