Missed CAN Rx Data in Mathworks Example As-is
Afficher commentaires plus anciens
Attempting to run CAN send/receive example in Simulink 2024b:
openExample('vnt/GetStartedWithCANCommunicationInSimulinkExample')
If I simply open this example and run the model, the solver auto settings cause missing CAN rx data contrary to the documentation. The solver settings are set to Variable Step initially:


It is ALSO the case that the plotted results change between clicking run multiple times, without changing anything:

Then, if I change the solver to Fixed Step and speed up the sample time to 0.0001sec, I begin to get less dropped data:

Only if I speed all the way up to 0.000001sec sample time do I get all of the transmitted CAN data in the result:

The example makes no mention of this so I believe it to be an unintentional error. Moreover, I am trying to understand why it requires such a fast sample time to receive all of the data. The example is creating a sine wave input with sample time 0.01sec which gets transmitted as a 64-bit signal in a single CAN message. The CAN Receive block is set to sample time of 0.01sec by default. So in my thinking, the model should be transmitting new data every 0.01sec based on the sine wave input sample time. And then receiving/unpacking the updated data every 0.01sec as well. With everything set to 0.01sec nothing should be missing. Why do we have to run the model at multiple magnitudes faster to receive everything properly?
1 commentaire
Réponses (0)
Catégories
En savoir plus sur Simulink dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!