On-board CAN Receive
R2026bLibraries:
Simulink Support Package for Arduino Hardware /
Communication
Description
Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.
Use the On-board CAN Receive block to receive CAN messages from the on-board Arduino® CAN controller. The block stores input messages in mailboxes in a first-in, first-out (FIFO) method. These mailboxes deliver the CAN messages to your Simulink® model in a queued order at every sample time.
Note
The On-board CAN Receive block supports C/C++ code generation. This feature allows you to generate C and C++ code using Embedded Coder®.
CAN Message Handling on Arduino Hardware
Use the On-board CAN Receive block to read incoming CAN messages promptly on the supported Arduino boards to prevent RX FIFO overflow and message loss.
For example, at any time, the on-board CAN controller on Teensy hardware can queue up to six incoming CAN messages in the RX FIFO.
As CAN messages arrive on the data bus,
The hardware places each message into the RX FIFO.
The block sequentially reads messages from the RX FIFO.
If messages arrive faster than the block sampling time, the RX FIFO gradually fills with the CAN data.
When the RX FIFO already contains six messages and another CAN message arrives before the block reads one, the CAN controller drops the new message. Under high data bus load, any delay in processing the incoming data can cause the RX FIFO to fill quickly and increase the risk of message loss.
Supported Arduino Boards
Arduino Due
Arduino compatible Teensy 4.0 and 4.1
Arduino UNO R4 Wi-Fi®
Arduino UNO R4 Minima
Arduino Nano R4
Ports
Output
Parameters
Version History
Introduced in R2024b
