CAN bus I/Os and networking

The The T5 runtime includes fully integrated CAN bus driver for management CAN messaging in your applications. Please refer to the following topics in that page for detailed information on how to use and configurate CAN networking:

Protocol specification
Data exchange
Configuration
Data types

Protocol specification:

The system supports CAN bus version 2.0A (11 bit header) or 2.0B (29 bit header). A project may include several CAN networks handled by various CAN controllers.

Data exchange - configuration:

The T5 runtime manages a intermediate variable map representing CAN inputs and outputs. A dedicated configuration tool is integrated in the Workbench. Run it using the "File / Open / Fieldbus Configuration" menu command from the main window. Then select the "CAN bus" configuration.

The configuration is represented as a tree:

- CAN bus Configuration
  - CAN network (*)
    - CAN message (*)
      - Exchanged Variable (*)

(*) The items with this mark can appear several times in the configuration.

Configuration:

Run the "Edit / New master" to declare a CAN network. Each network is identified by:

Description Free description text
Type CAN bus type (CAN 2.0A or CAN 2.0B)
Baudrate Baudrate in Kbs
Settings Port identification or settings (refer to OEM instructions)

When a network is selected, you can insert CAN messages by running the "Edit / New Slave - Data Block" menu command. For each message you need to enter the following items:

Description Free description text
ID CAN identifier entered in hexadecimal
Length Length of the message data (from 0 to 8)
Mode = Received Select this option to indicate a received message
Mode = Sent periodically Select this option to indicate a message sent by the runtime periodically (the min. period must be entered in this case)
Mode = Sent on request Select this option to indicate a message sent by the runtime on request (one shot). Such a message is sent once when the "command" variable configured for the message becomes TRUE. The driver then resets the command variable to FALSE. 
Mode = Sent on change of data Select this option to indicate a message sent by the runtime each time a variable connected to the message data changes. Min and max period must be entered in that case.
Min. period In case of "sent periodically" or "on change" modes, this is the minimum duration in between two emissions of the message.
Max. period In case of "on change" mode, this is the maximum duration in between two emissions of the message, even if the message data did not change.
RTR For a sent message, specifies a Remote Transmit Request
Initial data For a sent message, specifies the initial contents of the message data, in hexadecimal form
(e.g.:  2B 17 10 00 E8 03 00 00)

Now you have to map variables to the possible CAN message data. Use the "Edit / New variable" command to insert a variable in the selected message. For each configured variable, you need to specify the following items:

Symbol Symbol of the variable
Data exchange If selected, indicates an exchange between the variable and message data
Offset Offset (in bytes) of the data in the message
Bit Bit number (from 0 to 7) in case of a single bit data
Size Size of the data in the message
Format Storage format of the data in the message
Big endian Indicates a big endian byte ordering for multibyte data
Diagnostic / control If selected, specifies a special diagnostic or control exchange

Below are the possible values for diagnostic/control exchanges:

CAN errors Indicates current CAN errors (refer to OEM instructions)
CAN bus off Indicates the the CAN bus is off
Message received Indicates that the message was received since the next scan
At least one message received Indicates that at least one message was received on the network since the last scan
Send message command To use with "On request" sent message. The message is sent once when the variable becomes TRUE. The driver automatically resets the variable to FALSE when the message is sent
HW specific diagnostic Hardware specific diagnostic info (refer to OEM instructions)
HW specific control Hardware specific control command (refer to OEM instructions)

Data types:

You can freely map a variable of any data type to CAN message data. The runtime automatically converts the value to the type of the variable. STRING variables are not supported.