Engee documentation

Working with the block library RITM CAN FD

Library Blocks RITM CAN FD They are designed to configure the CAN FD interfaces, transmit and receive CAN and CAN FD frames, restart the interface and read the status of the controller.

To work with blocks, install or update the RITM Block support package by following these steps command in script editor interactive script icon or command line img 41 1 2:

engee.package.install("RITM-Engee-Blocks")

The path to the library: /RITM/RITM CAN FD.

The library includes the following blocks:

CAN bus for FD messages

Blocks RITM-CANFD TX and RITM-CANFD RX They use a tire CAN_FD_MESSAGE_BUS of the following type:

BusSignal{(:ProtocolMode, :Extended, :Length, :Remote, :Error, :BRS, :ESI, :DLC, :ID, :Reserved, :Timestamp, :Data), Tuple{UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt32, UInt32, Float64, UInt8}, ((), (), (), (), (), (), (), (), (), (), (), (64,)), :CAN_FD_MESSAGE_BUS}

The type describes a single CAN FD message. Ports of Messages blocks RITM-CANFD TX and RITM-CANFD RX they transmit an array of tires CAN_FD_MESSAGE_BUS; its length is set by the parameter Максимальное число сообщений:. The fields of each element of the array have the scalar types given below, and Data It is an array of 64 bytes.

Bus Fields:

Field Type Description

ProtocolMode

UInt8

Frame format: 0 — classic CAN, 1 — CAN FD.

Extended

UInt8

ID format: 0 — standard 11-bit, 1 — extended 29-bit.

Length

UInt8

The number of significant bytes in the field Data: before 8 for classic CAN and up to 64 for CAN FD.

Remote

UInt8

The RTR flag. Let’s say only for a classic CAN frame.

Error

UInt8

Indicates an error frame.

BRS

UInt8

Switching to data phase rate: 0 — without switching, 1 — with the switch. Allowed only for CAN FD.

ESI

UInt8

Error State Indicator of the CAN FD frame. It is allowed only for CAN FD.

DLC

UInt8

The code of the length of the received frame. When transmitting CAN FD, the actual DLC is determined by the field Length.

ID

UInt32

The frame ID. Maximum value — 0x7FF for standard and 0x1FFFFFFF for the extended format.

Reserved

UInt32

Reserved. When forming the frame, set 0.

Timestamp

Float64

The timestamp of the received message (not used during transmission).

Data

UInt8[64]

The payload. The first ones are significant Length bytes.

Exchange modes

  • CAN FD without switching speed: ProtocolMode = 1, BRS = 0. The entire frame is transmitted at a nominal rate.

  • CAN FD with speed switching: ProtocolMode = 1, BRS = 1. The arbitration phase is transmitted at a nominal rate, and the data phase is transmitted at a rate set by the parameter Скорость фазы данных:.

  • Combined CAN and CAN FD: the format of each transmitted frame is selected via ProtocolMode. Block RITM-CANFD RX accepts both formats and fills in ProtocolMode based on the frame that was actually taken.

Regular blocks RITM-CAN TX and RITM-CAN RX it can be connected to the output of the unit RITM-CANFD Setup and use it for classic frames on an interface configured in CAN FD mode. These units work with the bus CAN_MESSAGE_BUS and are not intended to represent CAN FD frames; for mixed incoming traffic, use RITM-CANFD RX.