CAN Bus

connections-canConnections – CAN

FieldDescription
ConfigurationConfiguration of CAN
Mail Boxes32 MailBoxes for message transmission
FilterFor configuring system consumers
TelemetryInteractions between system variables and CAN variables

Connections – CAN

Configuration

can_high

  • Baudrate: Global configuration baud rate.
  • TSEG1: Time segment 1.
  • TSEG2:Time segment 2.
Caution: These values should only be changed by experienced users, default values are as shown in the picture.

Mailboxes

Up to 32 mailboxes can be configured for message transmission and reception.

can-mailboxesCAN – Mailboxes

  • Configuration: Mailbox type.
    • TX: Transmission mailbox
    • RX: Reception mailbox
    • RXO: Reception overwrites mailbox
  • ID: 11-bit message TX or RX ID (decimal)
  • Length: Message size in bytes (1 to 8)
  • 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.
  • 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).
  • 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.

Filter

Filter is used for configuring system consumers. These parameters should only be edited by experienced users.

can-filterCAN – Filter

Telemetry

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

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), then press button 1 to automatically set the values of ID STD and Mask STD (or EXT).

Button 2 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).

Menu 3 sets the filter to differentiate between messages depending on its content. For each one of the bytes, the user indicates which bits are to be considered for the discrimination (0 in binary) and which are not (1 in binary). By default, this value is 255, which is eight 1s, so it doesn’t matter what is the content of the message that it will be read. On the other hand, if there is any 0 in the mask value (for example 254 is 111 1110, a 0 in the last position), that position has to match the value indicated in “Value” in order to be stored.

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

variables_can

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 are three additional parameters to configure:

  • Period: time in seconds between TX messages delivery.

 

  • Decimation: Decimation over global tx frequency. Ex.: for a 0.1 period and a 3 decimation, messages will be transmitted in periods of 0.3s.
  • Offset: A divider from decimation. Ex.: for a period of 0.1, a decimation value of 3 and an offset of 2, messages will be sent each 0.3s starting on the 0.2s

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.