Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: [ESP-WROOM-02]
- Core Version: [2.4.1-braddr see pull Eliminate gigantic blocking time inside ESP8266WiFiMulti::run #4888]
- Development Env: [makeEspArduino]
- Operating System: [Ubuntu]
Settings in IDE
- Module: [Generic ESP8266 Module]
- Flash Mode: [qio]
- Flash Size: [2MB/1MB]
- lwip Variant: [v2 Lower Memory]
- Reset Method: [http updater]
- Flash Frequency: [40Mhz]
- CPU Frequency: [80Mhz]
- Upload Using: [OTA]
Problem Description
Trying to find and reduce sources of > 10ms latencies and there's a repeatable 850-900ms between-loop latency after calling WiFi.begin(...) and before the WiFi.status() transitions to connected.
I'm opening this now without having identified the source of the latency for two reasons. 1) to give me a place to document my findings, and 2) in hopes that someone with internal knowledge will have pointers to provide.
MCVE Sketch
#include <ESP8266WiFi.h>
void setup() {
Serial.begin(74880);
Serial.println();
WiFi.persistent(false);
WiFi.setAutoConnect(false);
WiFi.begin("apname", "password");
}
void loop() {
static unsigned long exit_ms = millis(), enter_ms = millis(), counter = 0;
counter++;
enter_ms = millis();
unsigned long delta = enter_ms - exit_ms;
if (delta > 10) Serial.printf("%d ms: between loop #%d\n", delta, counter);
exit_ms = millis();
}
Debug Messages
SDK:2.2.1(cfd48f3)/Core:2.4.1/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1)
mode : sta(84:f3:eb:a1:89:03) + softAP(86:f3:eb:a1:89:03)
add if0
wifi evt: 8
wifi evt: 2
scandone
state: 0 -> 2 (b0)
887 ms: between loop #251586
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 5
cnt
connected with BradNet2, channel 11
dhcp client start...
wifi evt: 0
ip:192.168.0.42,mask:255.255.255.0,gw:192.168.0.1
wifi evt: 3
wifi evt: 7