Arm Mbed OS support forum

Losing data when using the UIPEthernet Mbed library

Hello! Using the UIPEthernet by @hudakz I have a problem: more than about 90% of the packets I send over UDP are lost. I have ENC28J60 module, microcontroller with MBED
and UIPEthernet library, I accept UDP data from the computer on ENC28J60 and everything works well, But the situation manifests itself only when I send more than two packets from the computer at the same time (of course, the computer does not send them “simultaneously”, I mean that the packets go one by one close to each other) I checked on other devices and when the computer-to-computer connection via Ethernet, everything works perfectly, but when I connect the computer to my ENC28J60 chip, a problem arises.

As far as I understand, if the microcontroller does not have time to pick up from the ENC28J60 it should be stored in a special memory inside the ENC28J60 and this should solve my problem, but no. Can anyone know what I am doing wrong and what is the mistake? I am attaching a part of the code in which the UDP reception is processed. I am a beginner in development, thank you all for help!

/////the code below runs endlessly in a circle after initializing and opening a socket with the desired port 

int size = socketReceive.parsePacket();

    if (size > 0)


        char *data = (char *)malloc(size + 1);
        int len =, size + 1);
        data[len] = 0;
///in this section, things are done with data and everything is ok
      } while ((size = socketReceive.available()) > 0);



  • Which revision of Mbed OS do you use?
  • What is your Mbed target board?

revision of Mbed OS - 6.60600.210128 (6.6.0)
target board - Nucleo f446re

I would suggest to try the new ENC28J60-EMAC driver rather than to use the old UIPEthernet library. It’s based on the native Mbed OS 6 Ethernet stacks and the hardware interface is the same as in case of the UIPEthernet. The biggest advantage of the ENC28J60-EMAC driver is that the application program code is same as in case of the native Mbed OS EMAC driver. This enables you to run all the Mbed OS 6 examples, the UDPSocket example included.

Thanks for the answer! I will try to follow your advice, I hope this helps…