arduino / arduino/ArduinoCore-renesas

Arduino Uno R4 Wifi UDP Delay

Open
#512 1 comment 0 reactions 0 assignees View on GitHub
topic: code type: imperfection
Dominant language
C
Stars
193
Forks
112
PR merge metrics
No merged PRs in 30d

Description

I have an application that uses Open Sound Control (UDP) Unicast packets from Node.js to the Arduino.

After updating the platform to version 1.5.1, my packets now have a delay of over three seconds in the loop that processes them and are of low reliability (dropped). Node will send a message and then there is a delay of 2-3 seconds (sometimes more).

The fault does not occur not when using version 1.4.1 of the platform. This is nearly instantaneous when using that version.

The version of the firmware on the "bridge" module of my UNO R4 WiFi board is 0.6.0.

An outgoing UDP packet from node:

## Javascript

This is a dead simple SLIP encoded UDP packet

```js
import { Client } from 'node-osc'

const sendOsc = (message, value, threshold = 0) => {
//Arduino
var osc3 = new Client(ARDUINO_IP, OSC_PORT)
osc3.send(message, value, threshold, () =>{
osc3.close()
})
oscLog(`${message} | ${value} | ${threshold}`, 'send')
}
```

I'm using the latest version of the `node-osc` package.

## Arduino sketch

```cpp
WiFiUDP Udp;
setup() {
//WIFI SETUP CODE OMMITED
int status = Udp.begin(RECEIVE_PORT);
Serial.println(status);
Serial.println("\nUDP Listening");
}

loop() {
//30Hz delay omitted, I read at 30 Hz
readUdp();
}

void readUdp() {
int len = Udp.parsePacket();
if (len > 0) {
OSCMessage msg;
Udp.readBytes(OSC_BUFFER, len);
Serial.println("Packet Received");
msg.fill(OSC_BUFFER, len);
if (msg.hasError()) {
Serial.println("Misformated message");
return; //Exit
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the UDP behavior with the provided Node.js sender and Arduino sketch on platform versions 1.5.1 and 1.4.1, noting the UNO R4 WiFi bridge firmware version 0.6.0. Compare packet delay and drop reliability in the loop; done means the regression is isolated or a verified fix restores near-instantaneous, reliable packet processing.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, cpp, javascript, node.js
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.