CAN Bus

Controller Area Network is a message-based protocol. It is made up two wires CAN High and CAN Low, being each of them configurable. Besides, Veronte includes two CAN bus connections.

Connections – CAN

FieldDescription
ConfigurationConfiguration of CAN
TelemetryInteractions between system variables and CAN variables

Configuration

In the configuration menu it is possible to modify the Baudrate and the Mailboxes. In order to add a mailbox select (1).

Mailboxes

Mailboxes are used to save the data received. In addition, it’s possible to configure more than one.

CAN – Mailboxes

  • Mailboxes: Allows the user to configure the number of Mailboxes used with a determined configuration.
  • Extended: Select 29-bit message.
  • ID: 11-bit / 29-bit message TX or RX ID (decimal)
  • Mask: This filter is configured for reception messages; received data will be stored on mailboxes where message ID coincides with mailbox ID. Mask adds some flexibility on the reception, when comparing message with mailbox data, only binary digits configured as 0 on the mask will be taken into account. (Ex.: For a configuration MASK: 00111 and ID:10110 all incoming messages addressed to 10XXX will be received in this mailbox).
  • Transmission: TX mailboxes should be configured in order to permit the message transmission trough the CAN port. Messages will be transmitted with the configured ID and size.
  • Reception: Received messages will be stored on RX mailboxes until this data is written on a consumer. Any incoming message received after configured mailboxes are full will be discarded. In case RXO mailbox has been configured, new incoming messages for this ID will be overwritten on the defined mailbox.
  • Overwrite: When storing data on mailboxes it is done on decreasing order, form 32 to 1. When using multiple mailboxes with same ID and one of them is RXO, it is recommended to set this mailbox on the lower mailbox position otherwise, all messages received for this ID will be overwritten on the same mailbox, not filling the buffer.

Telemetry

Interactions between system variables and CAN variables are managed from the telemetry configuration.

CAN – Telemetry

This tab contains the parameters to configure the interaction between the variables read from the CAN bus and the variables of the system. Once a message  is “captured” by Pipe (tab Configuration) and stored in the mailbox, its information can be read and save in the software. To perform that, press “+” to create a new message and introduce the ID (as written on the configuration).

Button 1 configure the endianness of the message, which indicates how the bytes that it contains are read: from left to right (big) or from right to left (little).

Button 2 displays the menu to configure how the bits of the message are divided and stored in the system variables.

There are four different elements to be added to the analysis of CAN messages:

  • Variable: used to store certain bits in a system variable (RX) or to send a certain variable through the CAN bus (TX). variable_config_canWhen reading data from a CAN bus it is common to have information about the message layout. In that case, let’s consider that the first 3 bits correspond to a certain variable. If that variable is always positive, unsigned has to be selected, if it could be positive or negative select signed. The fields Input/Output are used to make the transformation from binary to decimal, corresponding Input to the decimal value and Output to the binary one. Considering the example shown in the previous figure, the binary number is divided by 10 to make the transformation to decimal, so the variable represented here will go from 0 to 0.7 (as 3 unsigned bits can represent numbers from 0 to 7).
  • Skip: this option is used to discard a certain number of bits from the message (the maximum number of bits that can be skipped with a single “Skip” are 32).
  • Matcher: this option is used to send a constant value trough the BUS can, so it is used for the TX only. matcherIntroduce the number of bits and the value of the constant number sent trough the bus. As an example, a matcher of 8 bits with a value of 9 will be: 0000 1001

In  the TX section of the telemetry tab, there is an additional parameters to configure:

  • Period: time in seconds between TX messages delivery.

Finally, the option TX Ini is used to configure transmitted messages that are only sent once at the beginning of the operation, and which are normally related to the start-up of the external device connected via CAN. Its configuration is the same as in the previous cases, having now a new parameter call Delay (instead of a period, decimation and offset) to set the time between the start of the autopilot and the delivery of the initial message.