![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1114615/image.png)
How to reset a received CAN receive or unpack block
1 view (last 30 days)
Show older comments
I'm using the vehicle network toolbox for CAN communication. In the CAN network is a inverter included which, in case of power supply loss, sends out an EMCY message saying voltage drop. In my simulink model I'm checking if any errors occur and if they are still there when the (in this case) inverter is booting up again. Meaning: The error message 'voltage drop' is not bothering me at startup since the power has been switched on again and the inverter power supply is fine. But the CAN receive/unpack block stores the last value until it receives a new one which is not helping in this case since I'm not able to tell if there just hasn't been a new message (for example saying no errors) or if the error is still there or if a new error of the same kind appeared.
I tried different methods (including a resetable subsystem) and ways to clear this wrong message but none of them is working the way I was hoping they would. Is there any way to see when the last message with a specific ID was received and if there was none in a certain time span than reset the value to zero?
0 Comments
Answers (1)
Dimitri MANKOV
on 2 Sep 2022
Hi Felix,
Absolutely, you can use the "Timestamp" output port of the CAN Unpack block to check when the last message with this specific ID was received, and then build your Simulink logic around that:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1114615/image.png)
I hope this is helpful!
Dimitri
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!