CanDbc
Purpose:
-
Provide CANBus communications between Can Devices using basic can messages. It reads a *.dbc which provides the information on the parameters to monitor and creates the CyFlex variables to store the data. See Notes for a description of how the .dbc file is composed.
Enter:
-
CanDbc <filename.dbc> [usbpath1] [baud1=usbbaud1] <filename2.dbc>
[usbpath2] [baud2=usbbaud2] [time=clock_time]
[name=reg_name] [seed=<hexvalue>] [cpu=CPU_bit] [priority] [debug]
Where:
-
filename
Specify the name of the DBC file describing the data monitor. The DBC file describes the communications on a single CAN Network.
usbpath1
Optional. Specify a USB device as desired.
baud1
Optional. Specify a baud rate for a connected USB device.
filename2
Optional. Specify the name of a second DBC file to use to send a channel on an AC2 card. If specified, specify a second USB device.
usbpath2
Optional. Specify a second USB device.
baud2
Optional. Specify the baud rate for a second connected USB device.
time
Optional. Specify the update time. The default is 10.
name
Optional. Specify the desired register name. The default name is CanDbc.
seed
Optional. Specify a seed hex value for CCP protocol.
cpu
Optional. Specify a bit mask value to set on which CPU to function.
priority
Optional. Specify the task priority.
debug
Optional. Used to display incoming messages to the console
Example:
-
CanDbc /specs/cyflex.dbc 12 &
The above command starts the task at priority 12 reading the /specs/cyflex.dbc.CanDbc /specs/cyflex.dbc time=10 12 &
The above changes update time to 10, task at priority 12, reading the /specs/cyflex.dbc.CanDbc /specs/cyflex.dbc /specs/cyflex2.dbc 12 &
The above command starts the task at priority 12 reading the /specs/cyflex.dbc on one bus and reading /specs/cyflex2.dbc on a second bus.CanDbc /specs/cyflex.dbc /dev/pcanusb0 12 &
The above uses USB can device /dev/pcanusb0 with priority 12CanDbc /specs/cyflex.dbc /dev/pcanusb0 baud1=250000 12 &
The above uses USB can device /dev/pcanusb0 with priority 12 at baudrate 250000CanDbc /specs/cyflex.dbc /dev/pcanusb0 cyflex2.dbc /dev/pcanusb1 12 &
The above uses USB can device /dev/pcanusb0 with priority 12 reading the /specs/cyflex.dbc on one bus and reading /specs/cyflex2.dbc on a second bus.CanDbc /specs/cyflex.dbc /dev/pcanusb0 baud1=250000
/specs/cyflex2.dbc /dev/pcanusb1 baud2=125000 12 &
The above uses USB can device /dev/pcanusb0 with priority 12 reading the /specs/cyflex.dbc at baudrate 250000 on one bus and reading /specs/cyflex2.dbc on a second bus at baudrate 125000.Candbc /specs/cyflex.dbc 12 seed=0x1234568 &
The above command starts the task at priority 12 reading the /specs/cyflex.dbc using a seed key of 12345678.Candbc /specs/cyflex.dbc 12 cpu=8 &
The above command starts the task at priority 12 reading the /specs/cyflex.dbc running on CPU 3.
Notes:
-
Acceptable baud rates for USB are:
1000000
500000
250000
125000
50000
20000
10000
5000Acceptable baud rates for cards:
1000000
800000
500000
250000
125000
100000
50000
20000
10000Bit mask for a 4 core CPU:
-
0,1 = CPU 0
2,3,6,7,10 = CPU 1
4,5 = CPU 2
8,9 = CPU3Can restart the bus connection by setting the event candbc_reset
If you are having the problem: error while loading shared libraries: libpcan.so, then you may be missing a library. Check whether you have the library with the command: rpm -qa | grep pcandriver. If nothing shows up the you are missing the library. Install with: sudo yum install pcandriver
Example .dbc file:
Normally the .dbc is generated by another application or already exists. Once the files exists, there are a few parameters that can be changed to determine what message is being sent or read. Here is a sample message from a .dbc, the carrots denote the number format and are not actually in the .dbc file:<1> <2> <3>: <4> <5>
BO_ 3221225472 MSG_NAME: 0 Vector__XXX
<6> <7> :<8>|<9>@<10><11> (<12>,<13>) [<14>|<15>]”<16>” <17>
SG_ Var1 : 48|16@1+ (1,0) [0|65000] “%” Vector__XXX
SG_ Var2 : 32|16@1+ (1,0) [0|65000] “none” Vector__XXX
SG_ Var3 : 16|16@1+ (1,0) [0|65000] “none” Vector__XXX
SG_ Var4 : 0|16@1+ (1,0) [0|65000] “none” Vector__XXX- The BO_ indicates that this is a message
- The number after the BO_ is the message ID in base 10. When making changes to the .dbc, most devices and manuals give the ID in hex. You need to manually convert that.
- This is the message name
- This does nothing in CyFlex.
- This is just used as a brief description of the message and does 0nothing in CyFlex.
- The SG_ indicates this is a signal for a variable
- Is the variable name
- the offest of bits at the start of a message. This indicates what bits to use when setting the cyflex variables. (This is normally stated in the device manual)
- The size of the signal in bits. This indicates how many bits you use for the cyflex variable. (This is normally stated in the device manual)
- This value indicates if the device and message being sent is LITTLE_ENDIAN or BIG_ENDIAN. 1 is LITTLE_ENDIAN, 0 is BIG_ENDIAN
- The 10 is the ‘+’ sin above. – is for signed value, + is for unsigned.
- This value is the factor used when calculating the value. It takes the raw value and multiples by the factor.
- This value is the offset that is added after the factor has been multiplied.
physical_value = raw_value * factor + offset - Minimum value. The physical_value can not be lower than this
- Maximum value. The physical_value can not be higher than this
- This is the units to use in CyFlex
- Just a description, not useful
See Also:
candbc_list, candbc_set, candbc_clear, CAN Bus Interface Setup and Use