Description
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:
PING 192.168.0.29 (192.168.0.29) 56(84) bytes of data.
64 bytes from 192.168.0.29: icmp_seq=2 ttl=255 time=4.97 ms
64 bytes from 192.168.0.29: icmp_seq=3 ttl=255 time=2.77 ms
64 bytes from 192.168.0.29: icmp_seq=4 ttl=255 time=10.5 ms
64 bytes from 192.168.0.29: icmp_seq=5 ttl=255 time=7.51 ms
After pointing the browser at the webserver (loading the page only 1 time):
PING 192.168.0.29 (192.168.0.29) 56(84) bytes of data.
64 bytes from 192.168.0.29: icmp_seq=1 ttl=255 time=84.2 ms
64 bytes from 192.168.0.29: icmp_seq=2 ttl=255 time=1085 ms
64 bytes from 192.168.0.29: icmp_seq=3 ttl=255 time=77.4 ms
64 bytes from 192.168.0.29: icmp_seq=4 ttl=255 time=1074 ms
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:
- Disabling WIFI powersaving ( esp_wifi_set_ps(WIFI_PS_NONE); )
- Disabling PSRAM
- Using a AMS1117 voltage regulator instead of MCP1825
- Adding a 1000uF electrolytic cap
- Adding a 100nF ceramic cap
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
Multiple libraries were found for "WiFi.h"
Used: C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Using library ESPmDNS at version 1.0 in folder: C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\ESPmDNS
Using library WebServer at version 1.0 in folder: C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WebServer
Using library WiFi at version 1.0 in folder: C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi
Using library FS at version 1.0 in folder: C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\FS
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.