DBC's story

1.DBC definition

DBC (data base CAN) is the message content of CAN communication between automotive ECUs, which can only be understood by each other.

2. DBC view

DBC is a text file, which can be opened with Notepad, usually CANdb++, which can be viewed and edited more conveniently.

3. DBC composition

DBC is composed of a series of Message and Signal. The file defines the properties of Message and Signal. You can refer to the vector document (reply to "DBC document" to obtain). Here are some important keywords:

1) BO_

BO_ is the definition of Message.

  • Format: BO_ ID Name : DLC Transmiter
  • Example: BO_ 100 ESP_01: 8 ESP
  • Definition: sender=ESP, frame name=ESP_01, frame ID=0x64, message length=8 bytes

2)SG_

SG_ is the definition of Signal.

  • 格式:SG_ Name : StartBit | Length @ ByteOrder SignedFlag (Factor,Offset) [Minimum | Maximum] "Unit" Receiver1,Receiver2
  • Example: SG_ VehSpd : 7|16@0+ (0.01,0) [0|655.35] "km/h" ECM.TCM
  • Interpretation: Signal Name=VehSpd, Start Address=7, Length=16, Byte Order=MSB (Big Endian), Sign Bit=Unsigned, Coefficient=0.01, Offset=0, Min=0, Max= 655.35, unit=km/h, receiver=ECM and TCM

3)VAL_

VAL_ is the definition of the Signal enumeration value.

  • 格式:VAL_ ID Name key1 "value1" key2 "value2" ;
  • 例子:VAL_ 100 VehSpdValid 1 "Valid" 0 "Invalid" ;
  • Interpretation: frame ID=0x64, signal name=VehSpdValid, enumeration value (0x0=Invalid, 0x1=Valid)

4. DBC analysis

The format of DBC has been introduced above. Next, we will introduce how to use DBC to parse the physical value from the original message. Before that, understand MSB (big endian) and LSB (little endian). MSB is high-order first, LSB is low-order first, and most of them use MSB.

1) original value

Suppose there are 3 signals: signal1, signal2 and signal3, the lengths are 16, 4, and 12 respectively. These 3 signals include 3 types: complete byte, partial byte and span byte. Use Layout to compare. Bit manipulation instructions are used below: & is a bitwise AND, << is a left shift, >> is a right shift.

  • MSB





MSB high first.

signal1: start address=7, value=Byte0<<8+Byte1. (Byte0 is high, Byte1 is low)

signal2: start address=23, value=(Byte2&0xf0)>>4. (take the high 4 bits of Byte2)

signal3: start address=19, value=(Byte2&0x0f)<<8+Byte3. (Take the lower 4 bits of Byte2 as the upper bits)




  • LSB






LSB is the little bit first.

signal1: start address=0, value=Byte0+Byte1<<8. (Byte0 is low, Byte1 is high)

signal2: start address=16, value=Byte2&0x0f.

signal3: start address=20, value=(Byte2&0xf0)>>4+Byte3<<4. (Byte2 is low, Byte3 is high)

2) Physical value

Physical value=Original value*Factor+Offset

3) Code implementation

Take .NET (C#) as an example, draw the layout and calculate the value.

(Reply to "DBC example" for source code)

  • MSB







  • LSB








5. DBC open source information

(reply to "DBC open source" random access)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325840842&siteId=291194637