I have my ID's and i know what byte is what but I need a DBC file to make sense of that. I'm sure there is a free program somewhere that helps with their creation?
I work with CAN bus a lot. But what are DBC files? I've seen it in
Busmaster, but never used it.
DBC files are the underlying database files that define messages and signal names, so you can put entries in for ID's and bytes in those ID's messages and name them as well as i think apply formatting.
Just a cross reference incase you need this for the next step:
https://www.eevblog.com/forum/microcontrollers/vector-candb-to-cc-h-converter/
Uh I'm nowhere near that yet, just trying to write a simple DBC file to decode one message with 3 parameters in it. Reading and converting HEX is not the most ideal thing. I have found the Kvaser database editor, I think our design subcontractor uses it, he's in tomorrow so can give me a hand if all else fails.
Header and definition of Namespaces used:
VERSION ""
NS_ :
BU_
BO_
CM_
BO_TX_BU_
Define the CAN Nodes like this:
BU_: $Node1 $Node2
Define a CAN Frame like this:
BO_ $MessageID_decimal $FrameName: $DLC $SenderName
SG_ $SignalName : $SignalPos|$SignalLen@0$Signed ($Mult,$Offset) [$Range_from|$Range_to] "$Unit" $Receivers
One line per signal. Separate Messages via empty newline.
Where
- $DLC is number of bytes for this frame
- $SignalPos and $SignalLen is in bits, $SignalPos counted strangely reversed bitorder LSB(it)->MSB(it) (so "7|64" really means bits 0..63)
- $Signed is + or -
- $Receivers : comma separated list of nodes that will filter that signal
If a frame is by definition mapped to several mutually exclusive nodes (in reality it is a bad idea to have two nodes send the same ID) on a subnet, define it this way:
BO_TX_BU_ $MessageID_decimal : $Node1,$Node2;
Comments for various elements defined before:
CM_ "Bus description";
CM_ BU_ $SenderName "Sender description";
CM_ SG_ $MessageID_decimal $SignalName "Signal description";
That would be a minimal approach, but there is tons more in there to set key-value properties of signals and frames, i´ve got no idea if the format would be valid without it and load in tools that work with it.
Anyway, it is usually not worth the trouble messing with those proprietary formats, just load the raw data into a spreadsheet and go from there.
Editing the previous post would smash the formatting again, wanted to add this:
The file itself should be
- Windows line format, so CR+LF at line end
- UTF8 without BOM should be OK.
I work with CAN bus a lot. But what are DBC files? I've seen it in Busmaster, but never used it.
I've created a couple with bustmaster, handy when you have to apply conversion factors.. like for example when speed have to be shifted right by 7 bits to be human readable
Just so you know, keysight scopes (X3000 and up) have both CAN and CAN-DBC mode decodes. how cool is that
?