Is there anyway to determine the time since the last CAN message was received?
Hello Fernando Barrios,
I get where are you coming from now - for this I would suggest you use the Get bus tick block - you can find it in the Utility Blocks section. I would suggest you do like this:
Let us know if you find this approach satisfying.
I haven't tested this yet, but from what I can see the FCAN_Isr block has the Timestamp output, this should give you the timestamp for each CAN message received depending on the Event you have selected. I assume you are using the "Rx Complete" event. If that's the case, you should be able to read each timestamp and compare with the previous message and determine if it arrived within the time you expected.
As always Gustavo Ramirez is right! Sorry for the delayed message. You can compare the timestamp with the previous message timestamp and get the difference. Thanks again Gustavo for the quick reply!
Hi Constantin Razvan Chivu and Gustavo Ramirez,
I appreciate the suggestions, however I would like to determine if a system has failed by raising a flag if no message has arrived from that system after a certain amount of time. I could just compare it to the most recent CAN message received in general (from another system on the bus), but its not that accurate. Do you have any suggestions?
Fernando Barrios - I'd like to add a suggestion I would make if you're going with this method - you should not waste time computing the values back to us/ms at every check loop; you could just convert beforehand the failure_time to bus ticks, and save it as such in the model.
That is exactly what I need, thank you for the help!
Retrieving data ...