Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect a frozen CAN signal with XNET

I have a VI (while loop) that reads an XNET session from my CAN bus. Due to EMC problems, sometimes the sending device freezes. Consequently, the displayed values in LabView don't change anymore. They remain constant.

 

How can I detect if my cRIO is still receiving signals from this XNET session?

0 Kudos
Message 1 of 6
(564 Views)

If your session type is Signal, then you can do something like I've shown in this blog post where there is a Trigger signal that resets a timer. If the timer expires the values goes to NaN.

 

https://hooovahh.blogspot.com/2018/07/can-part-11-xnet-signal-drop-out-and.html

 

You can also have additional session types and have one be reading the raw frames. If there are no frames, then there is no new CAN values.

0 Kudos
Message 2 of 6
(554 Views)

First of all, thank you so much, this is exactly what I was looking for. It also work nicely if executed alone.

 

Unfortunately, I can't get it running with my CAN_READ loop (see screenshot). Error: "You tried to open the same frame twice. This is not permitted. Solution: Open each frame only once."

 

I partially understand the problem but can't figure out how to solve it.

Download All
0 Kudos
Message 3 of 6
(520 Views)

I managed to somehow merge the two loops together, see picture. However, I'm getting error -1074384589 from XNET Create Session.vi: NI-XNET: (Hex 0xBFF63133) "A cluster with the same name already exists in the database. Solution: Use another name for this cluster." 

Block Diagram.PNG

 

I had to use XNET Clear before XNET Create Session. The reason is that I need the initial XNET session from the left in the block diagram to extract the list of signals. Then, I reassemble the signal list. As I can't re-write this new signal list into the initial session, I try to create a new one. Not sure if this is the best approach.

0 Kudos
Message 4 of 6
(513 Views)

Instead of using two Signal Input sessions, you can open another Frame Input Stream session that acts like a Bus Monitor. You can use a timeout to poll if there is any traffic on the network. You can even check the ID for the incoming frames to see if they come from the expected device.

 

NI-XNET Error -1074384878: Maximum Number of Frames Has Been Exceeded

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 5 of 6
(498 Views)

This did the trick! I didn't realize that CAN frames include a timestamp while CAN signals don't.

While Hooovahs solution seems possible, I managed to implement your suggestion quite easily. For anyone interested I'll share my implementation. Not sure if my implementation with the many property nodes is the cleanest though.

Block Diagram.PNG

0 Kudos
Message 6 of 6
(472 Views)