dabbo
July 31, 2023, 5:27pm
1
New Arduino Nano ESP32 connected to laptop running Windows 11.
The example sketch at Files/Examples/WiFi/SimpleWiFiServer works but takes 25 seconds to respond to commands such as http://192.168.1.16/H .
(Note: I have changed Pin 5 to LED_BUILTIN because the LED pin is 13)
I have tried adding WiFi.setSleep(false) to the sketch. It didn't help.
Why running so slow??
dabbo
July 31, 2023, 6:42pm
2
I found out that if I disconnect the Nano ESP32 from the PC and power it from another power source then it responds instantaneously to commands. I’d like to know why please
Hello @dabbo , I assume that when you tried on the PC, the IDE was running. Was the serial monitor window open? I'm curious if you can try some combinations with or without serial, IDE, etc and see if that makes any difference. Thanks!
Might be related to this issue in the upstream ESP32 core:
opened 07:01AM - 14 Jul 22 UTC
closed 10:47AM - 14 Dec 22 UTC
Area: Performance
Area: Peripherals API
### Board
ESP32C3M1
### Device Description
Custom board:

### Hardware Configuration
GPIO 18 & 19 are connected to USB. USB is used to program the device and to monitor Serial.print output.
### Version
v2.0.3
### IDE Name
Arduino
### Operating System
MacOS 10.15.7
### Flash frequency
40Mhz
### PSRAM enabled
yes
### Upload speed
115200
### Description
USB is used to program the device and to monitor Serial.print output. However, when the device is unplugged, and the Serial.print() lines are left in the code, they cause delays of a second or so. Plugging back in will make the delays go away. If I remove the Serial.print() lines, it makes the delays disappear too.
### Sketch
```cpp
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#define LED_PIN 6
#define NEOPIXEL_PIN LED_PIN
Adafruit_NeoPixel pixels(1, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
Serial.print("Red... ");
// drawMessage("Test Red LED");
pixels.setPixelColor(0, pixels.Color(64, 0, 0));
pixels.show();
delay(500);
Serial.print("Green... ");
// drawMessage("Test Green LED");
pixels.setPixelColor(0, pixels.Color(0, 64, 0));
pixels.show();
delay(500);
Serial.print("Blue... ");
// drawMessage("Test Blue LED");
pixels.setPixelColor(0, pixels.Color(0, 0, 64));
pixels.show();
delay(500);
Serial.print("White... ");
// drawMessage("Test Whitish LED");
pixels.setPixelColor(0, pixels.Color(64, 64, 64));
pixels.show();
delay(500);
Serial.print("Off... ");
pixels.clear();
pixels.show();
delay(500);
Serial.println("Done. Looping");
}```
```
### Debug Message
```plain
There is no debug or error message.
```
### Other Steps to Reproduce
Run the sketch. While the device is plugged into a computer with Arduino, the lights flash faster. When you unplug the USB cable the lights slow down.
With more or longer Serial.print output, the delay can be more than a second.
That same code above is running on the two boards in this video. When you plug the USB in, you can see that the flash rate increases on the one plugged in.
https://user-images.githubusercontent.com/1689095/178857842-551736c3-3ac0-4adc-9bf8-758c5a6fa6ad.mov
### I have checked existing issues, online documentation and the Troubleshooting Guide
- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.