ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resynchronizing C-Series XNET CAN Modules

Solved!
Go to solution

Hi community,

 

I'm using a C-Series XNET NI-9860 to collect CAN data, I start the session on Monday and by Friday the timestamps of the signals have drifted by ~1 second relative to the system clock and can't be trusted anymore.

RHryniowski_1-1686326469952.png

 

I've read over some KB articles 

https://www.ni.com/docs/en-US/bundle/ni-xnet/page/nixnet/propertysessioninterfacesourceterminalstart...

https://www.ni.com/docs/en-US/bundle/ni-xnet/page/nixnet/synchronization.html

https://www.ni.com/docs/en-US/bundle/ni-xnet/page/nixnet/propertysessioninterfaceoutputstreamtiming....

 

But I don't understand how to synchronize the HW Clock to my system clock, and since it takes 4 days for the issue to return it's hard to trial.

 

If I stop then restart the session does this force the clocks to resync?  Or do I need to include a timing frame first?

RHryniowski_2-1686326685834.png

Thanks,

0 Kudos
Message 1 of 4
(1,867 Views)
Solution
Accepted by topic author RHryniowski

Regardless of which API is used, XNET will querry the host OS for the current system time when a Interface is started. At that point, the current time is placed into a interface specific timestamp regiseter on the XNET device. The timestamp register will then increment with every tick of the master timebase clock. When a CAN frame is acknowledged, a copy of the timestamp register is attached to the frame and placed into the receive buffer to be read by the XNET API.

 

Reference: Solved: Re: XNET Timestamp and Windows Timestamp Synchronization

 

So restarting the interface will force the hardware the query the OS time again.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
Message 2 of 4
(1,850 Views)

Thanks ZYOng,

 

The wording in the linked article is a little ambiguous, the commands I am using stop and start the session, the article uses the word interface.

 

This is the solution I went with, and I'll be watching for a few days to make sure it sticks, but is there a cleaner way?  Stopping and starting the session on the computer I have this deployed to takes ~4 seconds, (a lifetime in production) 😏.

 

 

0 Kudos
Message 3 of 4
(1,837 Views)

An XNET interface can have more than one session. I am not sure if simply restarting the session will help.

 

There is a property that allows you to adjust the time without restarting the interface. However, I think it is only supported on PXI/PXIe module.

ZYOng_0-1686341206706.png

 

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 4 of 4
(1,821 Views)