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]

<filename.dbc> [usbpath1] [baud1=baudrate] [filename2.dbc] [usbpath2] [baud2=baudrate] [time=clock_time] [name=reg_name] [priority]

Where:

filename.dbc

Specify the name of the DBC file describing the data to monitor. The DBC file describes the
communications on a single CAN Network.

usbpath1

Optional. Specify the USB device for the first interface.

baud1

Optional. Specify the baud rate for the first USB device.

filename2.dbc

Optional. Specify a second DBC file for an additional interface.

usbpath2

Optional. Specify a USB device for a second interface.

baud2

Optional. Specify a baud rate for a second USB device.

time

Optional. Specify an update time interval. The default is 10.

name

Optional. Specify the register name. The default name is CanDbc.

priority

Optional. Specify the task priority.

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 = CPU3

Example .dbc file:
Normally the .dbc is generated by another application or already exists. Once the files exist, 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
  1. The BO_ indicates that this is a message
  2. 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.
  3. This is the message name
  4. This does nothing in CyFlex.
  5. This is just used as a brief description of the message and does 0nothing in CyFlex.
  6. The SG_ indicates this is a signal for a variable
  7. Is the variable name
  8. 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)
  9. 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)
  10. This value indicates if the device and message being sent is LITTLE_ENDIAN or BIG_ENDIAN. 1 is LITTLE_ENDIAN, 0 is BIG_ENDIAN
  11. The 10 is the ‘+’ sin above. – is for signed value, + is for unsigned.
  12. This value is the factor used when calculating the value. It takes the raw value and multiples by the factor.
  13. This value is the offset that is added after the factor has been multiplied.
    physical_value = raw_value * factor + offset
  14. Minimum value. The physical_value cannot be lower than this
  15. Maximum value. The physical_value cannot be higher than this
  16. This is the units to use in CyFlex
  17. Just a description, not useful

See Also:

canfd_set, canfd_clear, canfd_list, canfd_full_list