CanFD
Purpose:
-
Provide CANBus communications between Can Devices using basic CAN FD 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:
-
CanFD <filename.dbc> [Network1] [baud1=baud1] [dbaud1=dbaud1] [sample1=samplepoint1] [dsample1=dsamplepoint1] <filename2.dbc> [Network2] [baud2=baud2] [dbaud2=dbaud2] [sample2=samplepoint2] [dsample2=dsamplepoint2] [time=clock_time] [name=reg_name] [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. Linux network interface name. Example can0
baud1
Optional. Specify a baud rate for a connected USB device.
dbaud1
Optional. Specify a dbaud rate for a connected USB device.
sample1
Optional. Specify a sample point for a connected USB device.
dsample1
Optional. Specify a dsample point 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. Linux network interface name for second device. Example can1
baud2
Optional. Specify the baud rate for a second connected USB device.
dbaud1
Optional. Specify a dbaud rate for a second connected USB device.
sample1
Optional. Specify a sample point for a second connected USB device.
dsample1
Optional. Specify a dsample point 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.
cpu
Optional. Specify a bit mask value to set on which CPU to function.
debug
Optional. Used to display incoming messages to the console
Example:
-
CanFD /specs/cyflex.dbc can0 baud1=500000 dbaud1=2000000 sample1=.75 dsample1=.8 &
The above command starts the task communication with the specfile /specs/cyflex.dbc on network can0 and sets the network settings.CanFD /specs/cyflex.dbc can0 baud1=500000 dbaud1=2000000 sample1=.75 dsample1=.8 time=10 &
The above changes update time to 10 with task communication on specfile /specs/cyflex.dbc on network can0 and sets the network settings.CanFD /specs/cyflex.dbc can0 baud1=500000 dbaud1=2000000 sample1=.75 dsample1=.8 cpu=8 &
The above command starts the task communication with the specfile /specs/cyflex.dbc on network can0 and sets the network settings running on CPU 3.
Notes:
-
Bit mask for a 4 core CPU:
-
0,1 = CPU 0
2,3,6,7,10 = CPU 1
4,5 = CPU 2
8,9 = CPU3Example .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