Simulink CAN timeout on embedded coder
Show older comments
Hello,
I am coding in Simulink using c2800x package, Embedded coder and Vehicle Networks Toolbox. I am using CAN bus in my application. What I could not solve is how to detect that I didnt receive message in some time (timeout. My code model is encapsulated in function call block of 100hz. Each eCAN receive block has its function call that calls can unpack. I tried to use CAN unpack timestamp or cantimeout block but it doesnt work on target. So I was trying to run some type of down counter outside of the can handling function block and reset it always when can message is received. Actually I didnt found any way to reset the counter out of the CAN receive function call. Mostly it wanted to use transition block which is not suitable. Any suggestions how to get some type of normal simulink signal out of that call or other way around?
Thank You for help.
3 Comments
Naini Dawar
on 25 Oct 2017
Hey Marek Laszlo,
Could you find a solution for this?
Regards
Marek Laszlo
on 25 Oct 2017
Birdman
on 25 Oct 2017
Hi Marek,
Can you share the simulink model(export to R2017a)?
Accepted Answer
More Answers (2)
Venkatesh Chilapur
on 13 Mar 2018
0 votes
You can create a counter and reset it when you get a CAN message (from the function call of the CAN block or an interrupt). If the counter reaches the timeout value before a CAN message is received, then we can trigger a specific subsystem.
1 Comment
Marek Laszlo
on 26 Mar 2018
Honey Kethan
9 minutes ago
0 votes
I am using a TI C2000 F280049C and was trying to do the same detect CAN Timeout, But I tried multple methods like
1) Post Intrupt when message is received on CAn RX block
2) Output Timestamp CAN unpack block
3) Output status on CAN unpack block
4) Reset Values to 0 on CAN Rx block
But none of the methods worked, To implement a times, I have to atleast know when message is received, But unfortunately was not able to do it on the hardware using Simulink blocksets, It basically shows the last value it has received and will not give any output related to new message received.
As in my application I am working is safety critical implementation this has been a major hardpoint for me, I am looking for some help with this. Would apprecite if anyone yould help
Categories
Find more on Timers and Scheduling 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!