LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamping ethernet packets

Without going to a 1588 solution, what is the recommended method for timestamping incoming Ethernet packets on a PXIe chassis with labView RT?

 

The packets of interest would be arriving at no faster than a few hundred Hz, but I need a timestamp accuracy <500us.  Running a task at 2kHz seems like overkill and something which could negatively impact the other high throughput tasks I have (Video and DAQmx acquisition).

 

Thanks!

 

XL600

0 Kudos
Message 1 of 5
(3,274 Views)

Your best bet will be to install NI TimeSync and use SNTP. The TimeSync user guide has some basic information, and the installers ships with a few examples that should be helpful.

0 Kudos
Message 2 of 5
(3,233 Views)

I do have timesync installed (14.5.0) but I don't have an NI Sync board.  The user guide doesn't mention anything about SNTP.  I'm not sure what SNTP would bring anyway and no examples seem to be installed showing what you are referring to.  Can you be a little more specific?

 

Also, for some reason, my PXIe-8135RT doesn't show SNTP configuration in MAX.  Only the Software 1588 configuration.

 

Thanks,

 

XL600

0 Kudos
Message 3 of 5
(3,217 Views)

I'm not sure that TimeSync has anything to help with what you are looking to do.  I don't necessarily know all of the features that TimeSync offers, but I believe that it is mostly for synchronizing timed structures, and the example that diabeticdaniel referenced is just a 20 kHz polling loop.

 

What is your goal in timestamping incoming Ethernet messages (MAC frames, IP segments, whatever)?  If it would suit your needs and is possible, I would recommend timestamping them with relavant timestamp information on the sender prior to sending.

 

Otherwise, I wouldn't expect you to be able to get sub-500 microsecond timestamps on receive time of frames without a driver that can access the NIC.

 

So you may have to go to a 1588 solution...



0 Kudos
Message 4 of 5
(3,208 Views)

The sender is not synchronized with my PXI system in any way (And I have no means to change that) so attempting to use sender embedded timestamps isn't an option.  All I really want to do is ensure my internal analog sampling timestamps and the Ethernet packet timestamps are aligned since I am comparing Ethernet data directly with various video, force, and position sensors connected to my PXI chassis.

 

The real world time isn't even important as long as timestamps within my PXI chassis are all aligned and <500us of error exists between the receipt of the Ethernet frame and the timestamping of that frame.

 

I did experiment with the following:

 

  • Send a UDP packet to the loopback address (And capture a RT High resolution timestamp when send) in one loop
  • Receive it in another loop using blocking receives and timestamp that

 

I saw a fairly consistent 17us difference between the send and receive timestamps.  Given that loopback is memory to memory, that doesn't surprise me.  The point though is that there doesn't seem to be very much delta between the UDP receive and the ability to capture a timestamp using the high resolution timer.  If that small of a delay exists when I am receiving real ethernet packets, I don't have any problem at all.  My trouble, of course, has been that I have no way to signal my PXI chassis when the packet is actually transmitted from the source to verify if the PXI chassis is able to capture the receive timestamp reliably with that small of a window.

0 Kudos
Message 5 of 5
(3,205 Views)