-
Notifications
You must be signed in to change notification settings - Fork 7.6k
esp32s2 tree: Slow response from HelloServer.ino and ICMP weirdness #4348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm unable to reproduce with a saola-1_v1.2 |
It's not the browser. Before connecting with "w3m" (Linux command line browser) the ping response is fast. After connecting with "w3m" the ping response is fluctuating. And it keep fluctuating for minutes (I don't know if it ever stops). The same web page works fine on ESP12 and ESP32-CAM. Subnetting is also correct, as I simply copied the code from my ESP12, and only changed the IP. It connects to the router with the correct static IP. But it doesn't respond to anything. Did you use the most recent version of the esp32s2 tree for compiling? |
Ok, I am able to reproduce the slowdown now. This looks to be an issue in WebServer, not esp32s2. I'll have to think about exactly why it presents like this, but if you add a delay, even delay(1), in loop, it will behave. |
I can confirm that delay(1) in the loop() fixes it. And my (large) code doesn't crash the board anymore when PSRAM is disabled and I connect to the webserver. Most likely a problem with not enough free heap due to lazy coding (Strings) though, not directly related. It does not fix the static IP problem, but that may be caused by my code (which works well on ESP12). I'll try some vanilla examples or something to see if it still happens. Will open a new issue if it does. |
* If WebServer.handleClient is run in a tight loop, it will starve other processes. So, if there is no connection, throw in a delay(1). Fixes #4348 * Made a variable to control the delay behavior
Hope for fix of espressif/arduino-esp32#4348
Was this really resolved? I tried the Delay(1) solution but with no luck. Seems to be more of a problem the more callbacks. Changing the callback timing so there is less likelihood of timing collisions helps but its still very slow by comparison to a 8266 |
Issue was solved and closed. If you have a reproducible issue, open a new issue and follow the issue template. |
I managed to "Band-Aid" this problem. The Delay(1) before WebServer.handleClient didnt help so on a guess it tried replacing the Delay call with a more "Non-Blocking solution". Hope this helps others. Place DoEvent(10) in your Loop() void DoEvents(int mils) { |
This I'm not an internals expert, but wouldn't |
Hardware/Software:
Arduino IDE version: 1.8.13
Board: ESP32-S2 Wrover
SDK Version: v4.3-dev-907-g6c17e3a64-dirty
Arduino ESP32 core: 1_0_4
PSRAM enabled: yes and no
Upload speed: 921600
OS: Windows 10
Description
Using the HelloServer.ino example on a ESP32-S2 Wrover I get slow responses when pointing my browser at the ESP32-S2 IP address.
A similar server (with ESP8266 default libraries) running on an ESP-12F or ESP32-CAM has reasonable response times (both have not been compiled with the esp32s2 tree of the Arduino IDE however).
According to the network request monitor in Firefox, connecting takes 600ms. Then there is a wait period of over 2000ms. After that, receiving takes 0ms (so it's most likely not a connection speed problem). So when 3 pages are requested at once (e.g. 1 html, 1 CSS and 1 JS) the response needs over 6 seconds.
Interesting is the ping response from the ESP32-S2.
Right after reset, before pointing the browser at the webserver:
After pointing the browser at the webserver (loading the page only 1 time):
The first connection after resetting the board sometimes produces an immediate response from the webserver.
Maybe related problem: When I set a static IP in WiFi config, the device connects to the router but does not respond to TCP or ping requests (maybe related?). It only works when letting DHCP choose the IP address.
What I've tried to fix the issue:
I designed the PCB myself (and I'm a PCB design beginner). Here is the schematic and PCB: https://easyeda.com/Miraculix200/esp32-s2-test
Anyway, I think a hardware problem can be ruled out, because the ping response is fine BEFORE connecting to the webserver.
Compiler messages
Unfortunately I wasn't able to install ESP-IDF properly, neither using Eclipse nor Visual Studio Code, so I can't tell if it's a problem with the esp32s2 tree of Arduino IDE, or something else.
The text was updated successfully, but these errors were encountered: