-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
I'm seeing delayed TCP and UDP packets on ESP32 and have discovered a high rate (30-50+%) of 802.11 frames being dropped and re-transmitted.
Symptom: I was originally trying to stream data from a PC to ESP32 via UDP at 60Hz. Although packets eventually arrived, there's a very high rate of delayed packets, with packets arriving in groups as measured by the ESP32. Delays ranged from 50ms-300ms.
Digging further, I found that the ESP32 WiFi stack itself is dropping packets. Here's a way I could test:
Setup:
- Minimal Arduino sketch that simply turns on WiFi, disables power saving mode, and does nothing in loop().
- Running Wireshark on Mac in monitor mode to capture 802.11 frames.
- Python script on Mac is sending UDP packets, ~850bytes each, to ESP32 at 60Hz.
- ESP32 placed next to the router for extremely high signal strength (RSSI = -4).
Wireshark shows many frame retransmissions.
Arduino 1.8.9 with ESP32 1.0.3 installed via Board Manager and NodeMCU-32S selected as board type.
Hardware: ESP-WROOM-32 module on a generic "ESP32 DEVKIT V1" breakout board.
Router: TP-Link Archer A20, WPA2 PSK
Hardware:
Board: ESP32 Dev Module
Core Installation version: 1.0.3
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Mac OSX
Sketch:
#include <WiFi.h>
const char* ssid = "xxxxx";
const char* pwd = "xxxxx";
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
WiFi.setHostname("minimalnet");
WiFi.begin(ssid, pwd);
WiFi.setSleep(false); // lower latency
}
void loop() {
static int x;
x++;
if (x % 10000000 == 0) {
Serial.print(WiFi.localIP());
Serial.print(" ");
Serial.println(WiFi.RSSI());
}
}
Debug Messages:
Enable Core debug level: Debug on tools menu of Arduino IDE, then put the serial output here
I don't see this option in the Tools menu of Arduino IDE.