Table of Contents
The CAN_in block implements an input mailbox that supports receiving messages using the CAN bus protocol. To send messages, the CAN out block should be used instead. The supported CAN protocol variants are as follows:
- CAN 2.0A: standard format (11-bit identifier), up to 8 bytes payload
- CAN 2.0B: extended format (29-bit identifier), up to 8 bytes payload
- CAN FD: standard and extended format, up to 64 bytes payload
CAN 2.0A/B are supported on all imperix controllers, provided that the related hardware exists. However, CAN FD (flexible data) is only supported on the B-Box 4. The detailed compatibility list is shown below.
CANopen is a high-level protocol (OSI layer 7), which should not be confused with CAN (OSI layers 1 and 2). It is currently not supported on imperix equipment.
| Controller | Hardware resources | CAN 2.0A | CAN 2.0B | CAN FD |
|---|---|---|---|---|
| B-Box 4 | 2x channels (one RJ45 socket for each) Max. 5 Mbps (FD) | Yes | Yes | Yes |
| B-Box 3 (RCP) | 1x channel (one RJ45 socket) Max. 1 Mbps | Yes | Yes | No |
| B-Board 3 (PRO) | 1x channel (Tx/Rx pins or D-sub on EVM) Max. 1 Mbps | Yes | Yes | No |
| B-Box micro | N/A | No | No | No |
| TPI 8032 | 1x channel (two common RJ45 sockets) Max. 1 Mbps | Yes | Yes | No |
Parameters
Addressing
- Physical port: selects the port on which the mailbox operate. Port B is only available for B-Box 4. For all the other devices, Port A must be selected.
- Frame format: selects between Standard (11-bit identifier) and Extended (29-bit identifier).
- Identifier (ID): sets the CAN identifier.
Communication parameters
- Signal(s) type: defines the data type accepted in the data input (int8, int16, int32, uint8, uint16, uint32, float32, or float64).
- Number of signals: specifies the vector size of the data to be sent.
- Byte order: defines the byte order in which the data will be sent. Either little-endian or big-endian.
- Data transmission mode: selects when the data is sent.
- On-demand: the user manually triggers the message transmissions.
- Periodically: the message is sent periodically, whether the data has been changed or not.
- Initial value: sets the initial data value of the data output before any data are received.
CAN bus configuration
In Simulink, the CAN bus configuration is performed from within the CAN block. In PLECS, the configuration is performed in the Target tab of Coder options windows (Coder -> Coder options, or Ctrl+Alt+B).
- The bitrate is the rate at which bits are transmitted on the bus (up to 1 Mbps),
- The data bitrate is the increased bitrate used to transmit the CAN FD frame payload when the Bit Rate Switch (BRS) is enabled (up to 5 Mbps).
Simulink block
Signal specification
- The data output signal returns a vector containing the data read from the CAN bus. The vector length can be configured with the Number of signals parameter. The output data type is configured by the Signal type parameter.
- The second signal is the data valid output. It is set to 1 each time new data are available.
Mask
PLECS block
Signal specification
- The data output signal returns a vector containing the data read from the CAN bus. The vector length can be configured with the Number of signals parameter. The output data type is configured by the Signal type parameter.
- The second signal is the data valid output. It is set to 1 each time new data are available.










