[DBC file analysis]

The directory structure is as follows

1. Basic introduction

2. DBC file

2.0, first come to a whole picture

2.1. At the beginning, there are two Tags, Version and new_symbols.

2.2. Definition of baud rate

2.3. Definition of network nodes

2.4. Definition of message frame

2.5. Definition of signal

2.6. Notes

2.7. Feature (attribute) definition part:

2.8. Value table part

protuesjzy has written two introductions to dbc files
https://blog.csdn.net/u012923807/article/details/96568412
https://blog.csdn.net/u012923807/article/details/94620323
are very well written, you can Browsing, this article is based on the understanding of dbc and refined on the basis of protuesjzy.

1. Basic introduction

DBC is the can network communication file format defined by vector company. Vector’s specification "DBC File Format Document" is obtained from the following link
Baidu network disk: https://pan.baidu.com/s/1GUvfEHv1NQbJ2bL2e7ZL5w
Extraction code: d622

2. DBC file

      DBC文件是以Tag(标签)来标识每一个元素。

2.0, first come to a whole picture

No. 55 Little White Duck wrote an introduction to dbc files.
He has a picture of the whole picture and borrowed it to give you an overview: As
insert image description here
shown in the picture above, a general dbc file contains the following 8 kinds of information:
1. Version and new Symbol
2, baud rate definition
3, network node definition
4, message frame definition
5, signal definition
6, annotation part
7, feature part
8, value table part
are explained in detail one by one below.

2.1. At the beginning, there are two Tags, Version and new_symbols.

insert image description here

2.2. Definition of baud rate

The format is as follows:
BS_:[baudrate:BTR1,BTR2];
Among them, BS_ is a keyword used to define the baud rate of the CAN network; [ ] content is represented as an optional part, which can be omitted (as shown in the example in the figure below, this part omitted);
but the keyword "BS_:" must exist, and an error will result if it is omitted. The "DBC File Format Document" specification clearly reminds that the BS_: label must be retained.
insert image description here

2.3. Definition of network nodes

Format:
BU_: Nodename1 Nodename2 Nodename3 ……

Explanation:
BU_ is a keyword, indicating
the names of network nodes Nodename1 and Nodename2, which are defined by the user;

Note: It is necessary to ensure that the node naminguniqueness

For example, BU_: VCU_Vehicle_Control_Unit MotorCtrol SCU PC Vector__XXX in the example: indicates that five network nodes
are defined:
VCU_Vehicle_Control_Unit
MotorCtrol
SCU
PC Vector__XXX

insert image description here
insert image description here

2.4. Definition of message frame

The format is as follows:
BO_ MessageId (expressed in decimal number) MessageName: MessageSize Transmitter
Explanation:
1), BO_ is a keyword, indicating a message;
2), MessageId is a message ID, expressed in a decimal number;
(such as an example 996 in it means that the message ID is 0x3E4, which is longlong type, which is the value of CAN ID;)
3), MessageName is the name of the message, and the naming rules are the same as C language variables;
4), MessageSize is the byte of the message data field It is an unsigned integer data, CAN 2.0 has a maximum of 8 bytes, and CAN FD has a maximum of 64 bytes;
5), Transmitter The network node of the message; if the message does not specify a sending node, this value needs to be set to "Vector__XXX".

For example, BO_ 201959408 MSG1: 8 VCU_Vehicle_Control_Unit
message ID: 201959408 (0xC09A7F0)
message name: MSG1
delimiter: ":"
message length: 8 bytes message
sender: VCU_Vehicle_Control_Unit
(sent by the node VCU_Vehicle_Control_Unit, The length of the data field is 8 bytes, the ID is 201959408 (0xC09A7F0), and the message named MSG1)
insert image description here

2.5. Definition of signal

The format is as follows:

SG_ SignalName (SigTypeDefinition) : StartBit|SignalSize@ByteOrder ValueType (Factor,Offset) [Min|Max] Unit Receiver

Explanation:
1), SG_ is a keyword, indicating a signal;
2), SignalName(SigTypeDefinition): indicating the name of the signal and the definition of the multiplex signal;
2.1) SigTypeDefinition is optional, and there are 3 formats:
a) empty, Indicates a normal signal.
b) M, represents the multiplexer signal.
c) m50, indicates the signal selected by the multiplexer, 50, indicates that when the value of the signal defined by M is equal to 50, the message uses this channel.
3), StartBit, SignalSize represent the start bit and signal length of the signal;
4), ByteOrder represent the byte order of the signal: 0 represents the Motorola format, 1 represents the Inter format;
5), ValueType represents the numerical type of the signal: + represents Unsigned number, - means signed number;
6), Factor, Offset means factor, offset; these two values ​​are used for the conversion between the original value of the signal and the physical value.
The conversion is as follows: physical value = original value * factor + offset;
7), Min|Max indicates the minimum and maximum values ​​of the signal, that is, specifies the range of the signal value; these two values ​​are double type;
8) , Unit indicates the physical unit of the signal, which is a string type;
9), Receiver indicates the receiving node of the signal; if the signal has no designated receiving node, it must be set to "Vector__XXX".
As shown in the example below:
the first signal:
SG_ S_Check : 45|10@0+ (0.00625,0) [0|160] “M” EL3160_60,ESC
Indicates that an ordinary signal named S_Check is defined, its start bit is the 45th bit, and the signal length is 10 bits; the signal is in
Motorola format, and the value type is an unsigned type number; the factor is 0.00625, and the offset is 0; the signal takes The value range is from 0 to 160;
the physical unit of the signal is the string "M"; the signal receiving node is EL3160_60 and ESC.
The second signal:
SG_ Send_Mux M : 7|8@0+ (1,0) [0|0] "" EL3160_60, ESC
means that a multiplexer signal named Send_Mux is defined, and its start bit is the first 7 bits, the signal length is 8 bits;
the signal is in Motorola format, and the value type is an unsigned number; the factor is 1, and the offset is 0; the value range of the signal is 0 to 0; the
physical unit of the signal is a string ""; the The signal receiving nodes are EL3160_60 and ESC.
This signal is used to select the channel.
The third signal:
SG_ S_Level_A_Voltage m50 : 15|16@0+ (0.00625,0) [0|160] "V" EL3160_60, ESC
means that a selected signal named S_Level_A_Voltage is defined, and its start bit is the 15th bit, the signal length is 16 bits;
the signal is in Motorola format, and the value type is an unsigned number; the factor is 0.00625, and the offset is 0; the value range of the signal is 0 to 160; the physical
unit of the signal is the string "V"; The signal receiving nodes are EL3160_60 and ESC.
insert image description here
insert image description here
Send_Mux is used as a selection channel. In this example, when Send_Mux is equal to 50, 51, 52, and 54, it represents the subsequent selection channel.

2.6. Notes

The format is as follows:

CM_ Object MessageId/NodeName “Comment”

Explanation:
1), CM_ is a keyword, indicating annotation information;

2), Object indicates the object type for annotation, which can be node "BU_", message "BO_", message "SG_";

3), MessageId/NodeName indicates the object to be annotated. If the previous object type is a signal or a message, the value here should be the ID of the message (expressed in decimal number); if the previous object type is a node, then The value here should be the name of the node;

4), Comment indicates the text information for annotation;

Such as CM_ SG_ 996 HUD_HeightLv “Control hud height level” in the example;

Indicates to comment on the signal named "HUD_HeightLv" under the message with ID 996 (0x3E4), and the content of the description is "Control hud height level".
Another example is CM_ BU_ HUD "Head Up Display"; means to comment on the HUD node, and the content of the description is "Head Up Display".

Comments are surrounded by "", and " signs are not allowed inside comments.
insert image description here

2.7. Feature (attribute) definition part:

There are three tags related to features:
1) BA_DEF_ Feature name type definition. The format is as follows:
BA_DEF_ Object AttributeName ValueType Min Max;
Explanation:
BA_DEF label
Object feature type, which can be BU_ (node ​​feature definition), BO_ (message feature definition), SG_ (signal feature definition), space (item feature definition);
AttributeName Feature name (C language variable format)
ValueType Feature value type (only decimal, hexadecimal, floating point number, enumeration, character 5 types)
Min Max Numerical type here appears range, enumeration type here is enumeration value , character type, here is empty.
insert image description here
2) BA_DEF_DEF_ Feature default value definition. The format is as follows:
BA_DEF_DEF_ AttributeName DefaultValue;
Explanation:
BA_DEF_DEF_ Label
AttributeName Feature name (C language variable format)
DefaultValue The default setting value of this feature
insert image description here
3) BA_ Feature item setting value definition, the format is as follows:
BA_ AttributeName projectValue;
insert image description here
Example:
BA_DEF_ BO_ "GenMsgCycleTime" INT 0 65535;

BA_DEF_DEF_ “GenMsgCycleTime” 2200;

BA_ “GenMsgCycleTime” BO_ 400 100;

Indicates that a feature is defined for the message type, the feature name is "GenMsgCycleTime", the feature value is integer data, and the value range is between 0 and 65535; the
default value is 2200;
the project setting value CAN ID==400 message The feature value is set to 100.
insert image description here
In DBCView4.3, BA_DEF_ and BA_DEF_DEF_ are merged together, and the feature view is used to manage, as shown in the figure below. insert image description here
Then the feature project setting value definition BA_ AttributeName projectValue; is merged with the element.
insert image description here

2.8. Value table part

The format is as follows:
VAL_ MessageId SignalName N "DefineN" ... 0 "Define0";
Explanation:
(1), VAL_ is a keyword, indicating the definition of the value table;

(2), MessageId indicates the message ID to which the signal belongs (expressed in decimal number);

(3), SignalName indicates the signal name;

(4), N "DefineN" ... 0 "Define0" indicates the content of the defined value table, that is, what symbol is used to represent the effective value of the signal.

For example, VAL_ 996 HUD_OffSt 1 "Active" 0 "Not Active" in the example;
means to define a value table for a signal named "HUD_OffSt" under this message with ID 996 (0x3E4);
use "Active" replaces 1; "Not Active" replaces 0. Only signals of the natural number type can be represented by a numerical table.
insert image description here
There are two ways to represent the value of the signal:
1) Physical value = original value * factor + offset; (conventional representation, mentioned earlier)
2) Digital table, used to represent logical values;

insert image description here
DBCView can be downloaded here:
Link: https://pan.baidu.com/s/1obK62q7gt4G595tuiOmgHw?pwd=fred
Extraction code: fred

Guess you like

Origin blog.csdn.net/u010808702/article/details/127433636