Table of Contents
The CAN input mailbox block allows receiving CAN messages with up to 8 bytes long payloads. To send messages with payloads of up to 8 bytes, the CAN output mailbox should be used.
It reads frames from the CAN bus and if the frame address matches the mailbox address, the data is applied to the output port of the block. The CAN input mailbox block features a second output that indicates that new data has been received. The value on the output data port will remain unchanged until new data are received.
The CAN frame unique identifier also represents the message priority. Therefore, frames with low identifiers will have the highest priority.
Only the CAN base frame format is supported, extended frame format is not. Therefore, the CAN address is limited to 11 bits (0 to 2047).
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 theSignal type
parameter. - The second signal is the data valid output. It is set to 1 each time new data are available.
Parameters
CAN address
: sets the CAN input mailbox address. If a CAN frame with a matching address is received the frame data is applied to the data output port of the block.Signal Type
: defines the type of the data output (int8, uint8, int16, uint16, int32, uint32, in64, uint64, float, or double).Number of signals
: sets the vector length of the data output. (from 1 to 8)Byte order
: defines the byte order in which the data will be read. (little-endian or big-endian)Initial value
: sets the initial data value of the data output before any data are received. The value is interpreted as a uint64.Baud rate
: configures the baud rate of the CAN bus. Baud rates up to 1 Mbit/s are supported.
The total number of bits read by a CAN input mailbox (resulting from
Signal type
and Number of signals
) can not exceed 64 bits (8 bytes), which is the maximum payload of a CAN frame.PLECS block
The CAN baud rate can be configured in the Imperix Controllers’ target window (Coder → Coder option → Target).
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 theSignal type
parameter. - The second signal is the data valid output. It is set to 1 each time new data are available.
Parameters
CAN address
: sets the CAN input mailbox address. If a CAN frame with a matching address is received the frame data is applied to the data output port of the block.Signal Type
: defines the type of to the data output (int8, uint8, int16, uint16, int32, uint32, in64, uint64, float, or double).Number of signals
:sets the vector length of the data output.Byte order
: defines the byte order in which the data will be read. (little-endian or big-endian)Initial value
: sets the initial data value of the data output before any data is received. The value is interpreted as a uint64.Baud rate
: configures the baud rate of the CAN bus. Baud rates up to 1 Mbit/s are supported.
The total number of bits read by a CAN input mailbox (resulting from
Signal type
and Number of signals
) can not exceed 64 bits (8 bytes), which is the maximum payload of a CAN frame.