Skip to content

Massive lost of received packages using UDP #53

Closed
@sstaub

Description

@sstaub

I have a big problem when using the UDP and receiving packages.
I use a simple code for testing UDP receive. This works fine when you get sometimes a package.
But when getting a bunch of messages more than 60% of the packages are lost.
I have the same problem with Mbed, so I think it could be a LWIP problem.
If I use nearly the same code for Teensy41 with NativeEthernet library based on FNET it works as expected
even with high data traffic, also when using WIZNet 5500 chips.
Following code for testing:

#include "Arduino.h"
#include "LwIP.h"
#include "STM32Ethernet.h"
#include "EthernetUdp.h"

IPAddress localIP(10, 101, 1, 201); // IP address of the microcontroller board
IPAddress subnet(255, 255, 0, 0); // subnet range
uint16_t localUdpPort = 8001;
IPAddress remoteIP(10, 101, 1, 100); // IP address of the gma3 console
uint16_t remotePort = 8000;

EthernetUDP udp;

void setup() {
  Serial.begin(9600);
  Ethernet.begin(localIP, subnet);
  udp.begin(localUdpPort);
  }

void loop() {
  static String message;
	int size;
  size = udp.parsePacket();
	if (size > 0) {
		// Fill the msg with all of the available bytes
		while (size--) message += (char)(udp.read());
    Serial.println(message);
		message = String();
		}
  }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions