Closed
Description
Board
OLIMEX ESP32-POE (but will happen anywhere I think)
Device Description
Stock OLIMEX ESP32-POE, but I believe this will happen on any board
Hardware Configuration
Nothing attached
Version
latest development Release Candidate (RC-X)
IDE Name
PlatformIO
Operating System
Ubuntu 22.04
Flash frequency
40MHz
PSRAM enabled
yes
Upload speed
115200
Description
The Arduino delay() function is implemented as follows:
arduino-esp32/cores/esp32/esp32-hal-misc.c
Line 178 in fcd4799
If portTICK_PERIOD_MS > 1 (i.e. CONFIG_FREERTOS_HZ < 1000), then small values will round down to 0, and no delay will happen. I'm not super familiar with the delay facilities in FreeRTOS / ESP-IDF but there has to be some way to do a shorter delay (busy-wait, if nothing else)?
See also: platformio/platform-espressif32#846
Sketch
// Run me with CONFIG_FREERTOS_HZ=100 to see the problem
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.printf("BEFORE msec=%lu\n", millis());
for (int i = 0; i < 20; ++i) delay(5);
Serial.printf("AFTER msec=%lu\n\n", millis());
}
Debug Message
(none)
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Labels
No labels