CAN simulation delay and distortion issues

11 views (last 30 days)
Fangxu
Fangxu on 11 Dec 2025 at 1:37
Answered: Ayush on 15 Dec 2025 at 4:26
Using the most basic CAN receiving and sending model that comes with Simulink without any modifications, without setting the message cycle, with a sampling time of 0.01s, the two simulation results are completely different. The official explanation for the case is delay. After setting the message cycle to 0.01s, the result is completely distorted. No matter how the sampling time and message cycle are changed, it will always be like this.
I don't understand why the result is so distorted and the message sending cycle is completely wrong.Any help is appriciated.

Answers (1)

Ayush
Ayush on 15 Dec 2025 at 4:26
Hi Fangxu,
I understand your concern about the distorted results when setting the CAN message cycle in Simulink.
This happens because, in Simulink, the simulation step (sampling time) and the CAN message cycle need to be perfectly aligned. If they are not, messages may be sent or received at unexpected times, causing data to appear distorted or out of sync. When the message cycle is left unset, messages are sent every simulation step, so everything stays synchronized. But when you set the message cycle, especially if it doesn’t exactly match the simulation step, timing mismatches and buffering can occur, leading to the issues you’re seeing.
To avoid this, make sure your sampling time and message cycle are set to the same value or are integer multiples of each other. You can refer the following documentation to know more about CAN transmission and reception:
Hope this helps!

Categories

Find more on Event Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!