How does the CAN DBC import parse CAN messages with Little-Endian format?
Question
How does the CAN DBC import parse CAN messages with Little-Endian format?
Answer
The format of a Little-Endian message definition in CAN DBC file is as follows
BO_ MsgID MsgName : MsgSize Transmitter SG_ SigName MuxInd : StartBit|SigSize@ByteOrder ValType (Factor,Offset) [Min|Max] Unit Receiver
Where
- BO_ - Start of Message definition
- MsgID - Message ID
- MsgName - Message Name
- MsgSize - Message Size
- Transmitter - Message Transmitter
- SG_ - Start of Signal definition
- SigName - Signal Name
- MuxInd - Multiplexer Indicator
- StartBit - Signal Starting Bit
- SigSize - Signal Size
- ByteOrder - Byte Order (Can be Little-Endian or Big-Endian)
- ValType - Value Type (Can be + or - indicating signed or unsigned)
- Factor - Factor
- Offset - Offset
- Min - Minimum Value
- Max - Maximum Value
- Unit - Signal Unit
- Receiver - Signal Receiver
Let's take an example
BO_ 0 MessageName: 8 Receiver SG_ sig1 : 10|10@1- (0.5,0) [-1|1] "unit1" Receiver1 SG_ sig2 : 52|10@1- (1,0) [-1|1] "unit2" Receiver1
The signal named 'sig1' is defined to start at bit # 10 and has a length of 10 bits. In CAN DBC file, the convention is to use the Saw Tooth bit pattern. Please take a look at the figure below. In Figure 1, the bits highlighted in blue represent this data. The swapping of bytes is due to the fact that this is Little-Endian format. While Saw Tooth pattern is used DBC file, we use monotone bit pattern in SimWB. Please note that in monotone representation, MSB is always used first. Hence in SimWB CAN I/O mapping, this will show up as 20|10. Similarly, the signal named 'sig2' will be represented in SimWB as 58:10. It means we will be using bits up to 58 in monotone.