0

Detecting Loss of CAN Communication using GFIN Blocks

JackT 1 year ago in IQANdesign updated by Gustav Widén (System support) 11 months ago 4

Hello,

I am utilizing GFIN to handle incoming CAN messages from a vehicle CAN bus. I am looking at detecting if the IQAN screen has lost communication from the CAN channel it communicates on. I tried using the "Timeout" feature on GFIN, though it seems to have a different definition than the "Timeout" given to the JFIN blocks.

I expect that if the GFIN block does not receive an updated CAN frame within the span of the Timeout value, the GFIN block would return a false pulse. The GFIN block does not seem to react this way. 

If I want to detect if a GFIN block has lost CAN communication, is this the right approach? Or is this not possible to do using the GFIN blocks. Perhaps there is another method I can try? Thanks.

Hey Jack

I believe CAN on iqan is limited to J1939 and CANopen. As I understand it when it comes to high level protocols that sit on CANbus  there are a lot more than just these 2. (https://en.wikipedia.org/wiki/CAN_bus#CAN-based_higher-layer_protocols) In terms of the protocols in use on devices that Parker intended to see IQAN in, J1939 and CANopen covers a lot of that ground. You covered off on Timeouts with J1939 leaving only CANopen to deal with in the iqan  space.

I think with CANopen you use the heartbeat for detecting failure of comms. As I understand it (Not that much as my CANopen additions have been mostly Cut and Paste with minor modifications!!) not every CanOpen device supports Heatbeat, but I do know that the Solution Examples included with Design do have examples of Heatbeat/Boot being used.

If unsure how to open the provided examples, Open up a new blank project allocate a master of some sort to the project and then click on the yellow add icon top Right of the design main window. On the popup window select the solutions tab and look for the "Other Can Communication" collection and open it up. Select the "CANopen example SCPT"

That will add a set of nested Function Groups, with the Heartbeat and Boot functionality embedded in the  CANopen startup Function Group. As always the CAN examples need you to link any Frame IN and Frame out to a configured Canbus on the master module so you'll need to do that if you want to play with the example in simulate to understand what is happening and why.... in so far as the limits of Simulate allow for canbus simulation.

There is a comment in the example that says this specific example doesn't use Heartbeat ongoing, just an initial boot message. If this example isn't enough there might be more CANopen examples people can share with you.... once you've determined that the high level protocol you need is actually CANopen and not some other form of high level protocol.

Andy

I am trying to figure out something very similar to what you are trying to do.   Does anyone know if there is a way to see the status of each module that you assigned CAN messages to and if there is a fault. 

I just want to know if these Timeout faults exist in the program, so I can display some feed back to the user saying that messages are lost via some flashing lights on the Keypad.   But I am unable to figure out how to get to this in the any of the function blocks. 

Image 3773

So this is what I was able to do to get me the basics of what I need, but there has to be a better way then this. 

All of my messages have a Time out of 5000ms for this one module.    So I did a Digital with an off time of 5000, and then when any of the messages are received it will reset the counter. 

Image 3774

Then I passed that to another digital to NOT it to flip the state.

Image 3775

This will only give me an error if ALL of the messages from this module are dropped, which is what I am after.  If you want to know if only one message is dropped then you will have to do a digital function block for each CAN GFIN, and then us a math block to count how many of them are TRUE.   Hope this helps you,   If anyone else knows a simpler way I would love to know. 

The JFIN and GFIN are True in the cycle where it has received a new matching frame.

If you define a timeout on the JFIN or GFIN, you can check this with the StatusOf() operation

StatusOf(New J1939 frame in) = stTimeout