Clear Filters
Clear Filters

Intermittent Delay seen using virtual CAN protocol

6 views (last 30 days)
Hello,
I am trying to setup a simple CAN bus loopback to configure the dbc file before deploying onto real hardware by using th Mathworks Virtual Channel blocks within the vehicle toolset.
When running the simulation there is an intermittent delay and frezzing of the receieivng signal and it varies from simulation to simulation. I tried running the Mathworks example 'GetStartedWithCANCommunicationInSimulinkExample' see what differences there were but it experienced the same issue?
Is this just a bug with using the virtual channels and will be resolved when deployed onto hardware or am I missing something?
See plot below: Top plot is my model with a free running counter and the bottom plot is the mathworks example. As you can see the signal lags and freezes.
Any and all insight into this would be appreciated.
Thanks

Answers (1)

Aman Banthia
Aman Banthia on 26 Sep 2023
Hello Calvin,
It seems like you're experiencing intermittent delays and freezing with the CAN bus loopback using MathWorks Virtual Channel blocks.
Here are a few things you could consider:
1. Task Overloading: The simulation could be getting overloaded if it's running too many tasks or computations simultaneously. Try to simplify your model or use a faster computer for the simulation.
2. Virtual Channel Limitations: The Virtual Channels are meant for initial development and testing, and they might not perfectly emulate the real-time behaviour of a physical CAN bus. Some timing inconsistencies might be expected.
3. Sample Time: Check the sample time of your model. If it's too small, the model might be trying to process data faster than it can, leading to delays and freezing.
4. Buffer Size: If the buffer size of the CAN Receive block is too small, it might cause delays if the buffer gets full. Try increasing the buffer size.
5. Block Parameters: Review the parameters of the CAN blocks in your model. Make sure they're correctly set according to your requirements.
Remember, the behaviour on actual hardware could be different and you might not experience these issues once you deploy your model to the hardware.
Hope the above suggestions work.
Best regards,
Aman Banthia

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!