Join us today!
Sending UDP packets will occasionally get stuck for 20-50ms
I am trying to send out a UDP packet, using the TF6310 FB_SocketUdpSendTo function block, every 100ms. I am using wireshark to measure the time it takes between packets, and I noticed that occasionally there is an additional delay (upwards of 50ms) between packets. There are no other protocols, that I am aware of, that are interfering with the UDP queue.
Basically what I have been seeing is this:
Packet A is put on the wire 100ms after previous packet
Packet B is put on the wire 150ms after packet A
Packet C is put on the wire 50ms after packet B
When dealing with network communications in real-time systems like the one you're working with, there can be several factors causing the additional delays you're observing. The function block might not always be prioritized by the operating system, which can lead to occasional delays. If your system supports real-time settings, you might need to adjust the priorities of the threads involved. Network stacks can buffer packets under certain conditions. Check if there are settings that might control buffering within the network stack that might be affecting transmission & ensure that the timing settings in the TF6310 FB_SocketUdpSendTo function block are configured correctly. This includes checking the cycle time of the task in which this function block runs.
Real-time tasks can sometimes experience jitter, where the execution interval varies slightly which could explain the irregular timing between packets. Intermediate network devices can also introduce latency, even if the network load isn’t from various protocols. They might be performing some sort of traffic management or have settings that affect certain types of traffic, like Quality of Service (QoS) configurations. Check the physical network infrastructure for any issues that could cause delays, such as poor cable quality or electromagnetic interference & test the lines. The act of capturing packets can introduce a delay or affect system performance, especially if the capturing system is under load. Ensure that the timestamps recorded by Wireshark are accurate. Wireshark relies on the capturing system's clock for timestamps, which can be affected by various factors. Also check if there are any updates or patches for your PLC system or the network equipment firmware that might address these types of inconsistencies.
For troubleshooting, I would temporarily isolate your network segment to see if external traffic might be influencing your results. Then reduce complexity by minimizing the number of devices and hops between your PLC and the monitoring system. Vary the timing and size of the packets to see how the system reacts under different conditions. Finally, monitor the CPU and memory usage of your PLC during packet transmission to identify any resource bottlenecks.
It’s also worth consulting the technical documentation for the controller’s function block or reach out to technical support for more specific advice tailored to your hardware and software setup – I recommend calling Beckhoff Mexico first.
Don't forget to tip the Admin ^_^ He's a swell guy & deserves the coffee.
- 17 Forums
- 267 Topics
- 924 Posts
- 0 Online
- 737 Members