W5500 stops recieving UDP after a certain period of time

I am using a SAMD21G MCU on a custom board with the Arduino bootloader. This board also has a WizNet W5500 Ethernet Controller connected to the default SPI bus, so that it works with the Arduino Ethernet library.

It works perfectly for sending and receiving UDP packets until a certain period of time has passed (usually around 10-20 minutes) then it continues to send and the loop function continues, but it no longer receives. Udp.parsePacket() and Udp.available() both return 0, as if nothing was being sent to the board. However, once the board is reset or power cycled, everything goes back to working.

Below is by code for receiving UDP:

bool UDPClass::readPacket() {
    if (Udp.parsePacket() != 0) {
        memset(uRecvBuffer, 0, RX_BUFFER_SIZE); // zero the receive buffer
        Udp.read(uRecvBuffer, RX_BUFFER_SIZE);  // read a packet into the receive buffer
        return true;
    }
    return false;
}

Any help would be appreciated!

if (Udp.parsePacket(); != 0) {

noob coder, but I have never seen a semicolon inside an if () condition.
Leo..

Wawa:
noob coder, but I have never seen a semicolon inside an if () condition.
Leo..

That's not my issue, just an error in copying and pasting the code.

The error is probably in the part you didn't post.

Please read the "How to post" sticky.
Leo..