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

2 vues (au cours des 30 derniers jours)
Allen Brock
Allen Brock le 19 Fév 2024
Réponse apportée : Ninad le 27 Fév 2024
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.

Réponses (1)

Ninad
Ninad le 27 Fév 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

Catégories

En savoir plus sur Vehicle Network Toolbox dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by