Documentation Center

  • Trial Software
  • Product Updates

CAN Communication 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 Vehicle Network Toolbox demos.

Using Mux Blocks

  • Use a Mux 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 block.

Message Reception Workflow

For workflow examples, see Build CAN Communication Simulink Models and the Vehicle Network Toolbox demos.

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.

Was this topic helpful?