Clear Filters
Clear Filters

How can I use the Vehicle Network Toolbox to transmit CAN messages asynchronously

5 views (last 30 days)
I need to transmit CAN messages neither periodicly nor on data change, which are the only two options in the CAN Transmit block. Putting the CAN Transmit block within a triggered subsystem doesn't seem to prevent the transmit if periodic is selected once it triggers the first time. Is there a way to indicate to trigger a CAN Message transmit asynchronously based on some logic within my model?
As a quick example of a use case, the heartbeat protocol from CANOpen would have a single message on a device's logical 'boot' with data 0x00. After that, the device moves to pre-op and a periodic message is sent with data 0x7F at some defined rate. If a NMT start is received, the data changes to 0x05 for operational. If a NMT stop is received, the message stops transmitting completely.

Answers (1)

Ninad
Ninad on 27 Feb 2024
Hi Allen,
You can use Event-Based CAN Message Transmission Behavior in Simulink. This feature allows for CAN and CAN FD message transmission when a change in data from one time step to the next is detected. Here is the reference link:
You will also have to Implement a custom logic or state machine to manage CAN message transmission in your model.
Regards,
Ninad

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!