This is a static, read-only archive of Wireshark Q&A. Older questions and answers from October 2017 and earlier can be found at osqa-ask.wireshark.org.
0

Out-of-order EtherCAT frames with identical timestamps

asked Nov 19 '25

updated Nov 19 '25

I am using Wireshark on a Windows 11 PC, capturing OP cyclic frames from a TwinCAT PLC program acting as the EtherCAT master. The network has only two devices, this Master and one additional slave. Wireshark is running on the same Windows 11 PC.

The issue is random frames logged out of order and with identical timestamps Here is a snippet from a log showing this. Notice frames 5616 through 5619:

----------------------------------------
Frame | Time     | Source
----------------------------------------
5609  | 2.793484 | 10GtekTransc_22:21:a3  <--Good: Transmitted from Master
5610  | 2.793493 | BeckhoffAuto_01:00:00  <--Good: Paired with frame 5609 returned to Master
5612  | 2.794567 | 10GtekTransc_22:21:a3  <--Good: Transmitted from Master
5613  | 2.794576 | BeckhoffAuto_01:00:00  <--Good: Paired with frame 5612 returned to Master
5614  | 2.795562 | 10GtekTransc_22:21:a3  <--Good: Transmitted from Master
5615  | 2.795570 | BeckhoffAuto_01:00:00  <--Good: Paired with frame 5614 returned to Master

5616  | 2.796880 | 10GtekTransc_22:21:a3  <--Issue: From Master, has same Timestamp as #5617
5617  | 2.796880 | 10GtekTransc_22:21:a3  <--Issue: From Master, has same Timestamp as #5616
5618  | 2.796891 | BeckhoffAuto_01:00:00  <--Issue: To Master, same Timestamp as #5619
5619  | 2.796891 | BeckhoffAuto_01:00:00  <--Issue: To Master, same Timestamp as #5618

5620  | 2.797946 | 10GtekTransc_22:21:a3  <--Good: Transmitted from Master
5621  | 2.797953 | BeckhoffAuto_01:00:00  <--Good: Paired with frame 5620 returned to Master

Frames 5616 and 5618 are a matching TX/RX pair. Frames 5617 and 5619 are also paired frames. All the frames have unique payloads, so the frames can be easily matched. This example is repeated throughout the log with these anomalies occurring ~0.91% of the time (about 3,808 times out of over 150,000 frames captured).

I have read some other posts here, but none specifically like this, especially with EtherCAT where frames can only be in specific orders and period timing.

What are possible explanations for these out-of-order frames and the identical timestamps?

Comments

Wireshark and presumably npcap versions?

User 98587 ( Nov 19 '25 )

The issue is random frames logged out of order and with identical timestamps

How is the log generated?

User 2763 ( Nov 19 '25 )

Hi! Wireshark: Version 4.6.0 (v4.6.0-0-gcdfb6721e77c). Npcap 1.83, libpcap 1.10.5

User 94295 ( Nov 19 '25 )

The log is a standard Wireshark log that I exported as CVS into Excel for the post.

User 94295 ( Nov 19 '25 )

logged out of order

So Wireshark isn't flagging them as out of order, it's just that the log is not showing the tick tock of alternating rx and tx packet?

The Network Capture Playbook Part 1 – Ethernet Basics

If you can live with the distorted packets, do a local capture. If you can’t, and you need your capture to be precise (which is especially true for most troubleshooting cases where timings or connection aborts are involved), you need to do something better.

(The Network Packet Capture Playbook)

User 2763 ( Nov 19 '25 )

😔 They are not flagged as out of order unfortunately, but "appear" as correct in the log. In the EtherCAT log as a whole, frames are logged in correct order >99% of the time and with expected timestamps.


But periodically, there will be four frames out of order. Instead of receiving the expected order of...

   Frame (A) from Master, 
   Frame (A) returned to Master, 

   Frame (B) from Master, <--Timestamp is about +1ms greater than "Frame (A) from Master"
   Frame (B) returned to Master

.
and so on. The above is what is expected, but periodically the log will show... .

   Frame (A) from Master, <--These two have Identical Timestamps
   Frame (B) from Master,  

   Frame (A) returned to Master, <--These two have Identical Timestamps
   Frame (B) returned to Master

. ...and the two 'from Master' frames will have identical timestamps and the two 'to Master' frames will have identical timestamps. After these four frames, the order and timestamps return to the expected order until it will eventually be logged again.
.

BONUS: Another odd thing is that these occurrences of the four frames all seem to calculate to be within the same 1ms period. The TwinCAT PLC program is set to begin broadcasting out the frames every 1ms, so each pairing of "From Master" and "To Master" frames should be logged within its own ~1ms period/timeframe. In my system, the Master is connected directly to the EtherCAT slave with a single CAT5/6 cable, no other devices on the network.


But these four out-of-order frames occurrences, besides having the matching timestamps, also calculate to be within a near 1ms period. If I look at the delta of the "From Master" frames prior to the anomalies, many times the ~1ms period seem to extend in these prior frames, sometimes as much as 1.2ms from the typical ~1.05. This is not always the case, but when seen, the anomaly will certainly happen afterwards. Possibly the system begins lagging in the capture and the anomaly happens as it corrects itself? Just guessing.


User 94295 ( Nov 19 '25 )

1 Answer

0

answered Nov 19 '25

I believe this to be the culprit, but not the underlying cause:

A sanity check first…

In EtherCAT, the network cabling is daisy-chained and looped back to the Master. For every frame the Master transmits, it should receive this frame back before any other frames transmitted by the Master are received back--they will always be in order. It should be impossible for a Master to transmit two frames onto the network, and then receive the frames back in the wrong order.

An EtherCAT slave cannot initiate any frames onto the network but only can modify a passing frame as it 'flies' by, so the slave cannot change the order.

So what is probably happening is this:

  1. Under normal expectations, the Master transmits the frame at 0ms. The return frame is received about 11 microseconds later (~0.01ms). The Master pauses for ~0.99ms and then transmits the next frame.
  2. The Master (here TwinCAT running on Windows 11) falls behind, possibly by other processes activating in the system.
  3. Being behind, the Master misses a scheduled frame to transmit in the given period and the frame is stuck in queue.
  4. In the next period, the Master transmits the queued frame and the scheduled period's current frame as well. This results in two frames transmitted back-to-back from the Master with identical timestamps.
  5. With the two Master frames in transit, they both return about ~11us later as two responses that are also back-to-back with identical timestamps.

The log shows the timestamps in only microsecond precision, while the actual timestamp is probably in nanosecond ranges which would falsely give the appearance of identical timestamps that are actually off by nanoseconds.

These steps would explain the log anomaly, but not the specific cause of the PC Master lagging. I will continue investigating this avenue and give updates.

In the meanwhile, I very much appreciate suggestions, corrections, and alternate ideas!


Comments

Are you able to use Linux, macOS, or some other operating system other than Windows to do the capture? Higher resolution (not nanosecond in reality, actually 100 nsecs because that's what Windows has) will be available soon in the next release of libpcap, but Linux, macOS, and other OSes have had nanosecond timestamp resolution for years.

User 82682 ( Nov 19 '25 )

Hi John! I have Linux machines but would have to dust them off the shelf. The 100ns precision of Windows has been a thing for too long. Under normal captures, microsecond precision is fine for my system but if the logs did have nanosecond precision, it would be clear if my answer here is indeed the culprit. I think it is actually and am going to do some tests with TwinCAT to verify this and hopefully bypass the issue..

User 94295 ( Nov 20 '25 )
cc-by-sa Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.