Arduino Ethernet Shield 2 - UDP Send Occasionally Sends Lots of Packets??

Hi All,

First time poster, long time listener here. I am pretty stumped on this one.

I am using an Ethernet Shield to send a UDP command to another device on my LAN when a button is pushed.

I have 3 Arduinos running the exact same code (except for adjustments to network settings per Arduino).

Only 1 Arduino is giving me trouble. The other two are working great with the same code.

Occasionally, this Arduino will send dozens of UDP packets as fast as possible - flooding the network with traffic for a few seconds. See my wireshark screenshots attached for “normal” behavior when the button pushed rapidly, versus “error” behavior.

Troubleshooting steps I’ve done so far.

-Implemented button debouncing per Arduino.CC example.
-Added a counter to increment whenever my msg.send(Udp) command was executed, to see if I could log the dozens of dozens of uncommanded UDP packets. But the counter did not increment faster than my actual button pushes.
-Added a 500ms delay to my send UDP function, so it would not be possible to rapidly send packets. This did not work either - was still able to see packet spam on occasion.

So I’m wondering.

Is this a hardware issue with this Ethernet Shield in Particular?
Is there an issue with the OSCMessage.h or EthernetUdp.h libraries?
Something else I’m missing???

I’ve attached a simplified copy of my program for review, as well.

For_Network_Debug.ino (7.31 KB)

Any listeners out there?? I would love to know what mistakes I’m making or what steps I’m missing here.

Thanks all,

First step, check the success/fail return value from UDP.endPacket();
Does a 'fail' coincide with a packet burst?

Are your 3 Aduinos connected to 3 ports on the same ethernet switch?
Try swapping cables to see if the problem is specific to a particular port.

Update - appears to have been a hardware issue with the Ethernet Shield.

I have made no adjustments other than swapping shields - the problem persisted with the suspect shield - and a new shield fixed the "problem" Arduino immediately.

No changes to code.

Of 5 Ethernet V2 Shields that I have purchased, 1 was DOA, 1 had this "packet spam" issue, and the other 3 appear to be working fine.

Very frustrating failure rate.

Thanks for your time Mikb55, and anybody else who took a look at this.