W5500 MACRAW mode send delay

Hello kind people.
My W5500 works in MACRAW mode . My program needs to send EtherCAT packet every 4ms in hard realtime environment. I am doing the following steps in the 4ms timer:

  1. read S0_TX_WR;
  2. write Socket 0 Transimit Data;
  3. update S0_TX_WR;
  4. write S0_CR_SEND to S0_CR which starts the transmitting;
  5. wait until S0_CR is 0;
  6. wait until S0_IR S0_IR_SENDOK is set;
  7. clear S0_IR_SENDOK ;
  8. wait until S0_TX_RD is equal to the value written to S0_TX_WR in step 3.

I capture the network flow using Wireshark running on a high performance desktop PC. The results shows that some times W5500 does NOT starts to transmit packet fast enough when S0_CR_SEND is written. In the worst case the packet is sent after 18ms on the wire together with its following packets. My Servo Driver device also alarms PDO timeouts. So i am pretty sure that the packet is delayed on the wire.

But the datasheet says: SEND command transmits the saved data from the current Sn_TX_RD to the Sn_TX_WR in the Socket n TX Buffer. After transmitting the saved data, the SEND command increases theSn_TX_RD as same as the Sn_TX_WR.

How could this happen? Multiple packets sent in one cycle. Wireshare capture is filtered with frame.time_delta > 0.005 to show the bad packets.

What PHYCFGR shows when issue happens?

Thank you for your quick answer. I have double checked the net flow and finally found that there is nothing wrong with W5500. Wireshark packet timestamp is not right.

Thanks!