Main Content

CAN Communication Workflows in Simulink

Message Transmission Workflow

This workflow represents the most common CAN Transmit model. Adjust your model as needed. For more workflow examples, see Build CAN Communication Simulink Models and the “Simulink Tutorials” in the Vehicle Network Toolbox examples.

Work flow diagram for CAN message transmission in Simulink

Using Mux Blocks

  • Use a Mux (Simulink) block to combine every message from the source if they are transmitted at the same rate.

  • Use one CAN Transmit block for each configured Mux (Simulink) block.

Message Reception Workflow

Message Filtering

Set up filters to process only relevant messages. This ensures optimal simulation performance.

Do not set up filters if you need to parse all bus communications.

Function-Call Triggered Message Processing

Set up your CAN Unpack block:

  • In a function-call triggered subsystem if you want to unpack every message received by your CAN Receive block.

  • Without a function-call triggered subsystem if you want to unpack only the most recent message received by your CAN Receive block.
    Set up this system if your receive block is filtering for a single message.

Downstream Processing

For any downstream processing using received messages, include blocks:

  • Within the function-call subsystem if your downstream process must respond to all messages received in a single timestep in this model.

  • Outside the function-call subsystem if your downstream process responds only to the most recent message received in a given timestep in this model.
    In this case, the CAN Unpack block will not respond to any other messages received, irrespective of the messages ID.