Skip to content

Arduino Uno R4 Wifi UDP Delay #512

@danielbchapman

Description

@danielbchapman

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

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

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
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions