Intermittent Delay seen using virtual CAN protocol
5 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1490087/image.jpeg)
0 个评论
回答(1 个)
arushi
2024-8-19,10:21
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vehicle Network Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!