Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Time since Last XNET message increases over days (LIN, XNET Read SignalXY)

Solved!
Go to solution

Hello folks,

so I have a working XNET Session with PC NI 9866 as Master and 1 to 12 Slave ECUs.

And I like to know, if one of those connections dies.

For that i use the Method with XNET Read Signal XY, described in this Post: 

https://forums.ni.com/t5/Automotive-and-Embedded-Networks/XNet-Single-Point-Read-Hold-Time/m-p/36818...

(thanks for that, Hooovahh).

 

heres my Read Function:

Lichtenheld_1-1675167023038.png

 

and the SubVI to check how 'old' the timestamps of those signals are:

Lichtenheld_2-1675167199376.png

i call those VIs 6 times a second.

 

Here is my Problem:

over days the "time since Last LIN Data" increases slowly from 0,05.. seconds to 5seconds(where I throw an error).

when I look at the bus with an oszi, it looks good. no delays.

 

Is there a better way to archieve my goal?

 

 

 

 

 

 

0 Kudos
Message 1 of 3
(2,142 Views)
Solution
Accepted by topic author M.Lichtenheld

I don't fully understand what you are doing.  But I would suggest you read all frames in each read then process them.  Your code is only reading one frame, but if a dozen frames come in between reads, then you have 11 frames sitting in the queue to be read.  Then the next time you do a read on one frame you have even more frames waiting to be read.  This might be why time slowly drifts over time.

 

I suggest performing a read of -1 returning all frames.  Then you can use the Delete From Array to get the last element in the array, and use that for the time comparison.  Assuming the array isn't empty, which would indicate no frames came in since the last read.

Message 2 of 3
(2,115 Views)

thanks Hooovahh,

 

you send me on the right track.

No matter what I wired to the "numbers to read" Input from XNET Read, there where always just one set of incoming LIN data at the output.

 

I forgot to set the "XNET Create Session" Vi to "Signal in XY" Mode. After I changed that, everything works as expected.

Problem solved.

0 Kudos
Message 3 of 3
(2,096 Views)