ESP32 Wake Stub Not Executing
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about ESP32 Wake Stub Not Executing. We cover key concepts, practical examples, and best practices.
The Problem
ESP32 wake stub (RTC fast memory code) runs on cold boot but not on wake from deep sleep.
Quick Fix
Wrong
// No wake stub defined. Full setup() runs on every wake.
Full boot takes 150ms. Extra power consumed on every wake.
Right
void RTC_IRAM_ATTR esp_wake_deep_sleep() {
esp_default_wake_deep_sleep();
// Quick actions: increment counter, read sensor, set GPIO
RTC_DATA_ATTR int count = 0;
count++;
if (count % 10 == 0) {
esp_deep_sleep_start(); // Continue sleep for 9/10 wakes
}
}
void setup() {
// Runs only when ESP decides to boot fully
Serial.begin(115200);
Serial.println("Full boot");
}
(Wakes 9 times without serial output, 10th wake: Full boot)
Prevention
Place wake stub in RTC_IRAM_ATTR section. Stub runs before DRAM is restored. Keep stub minimal (<512 bytes). Use stub to decide whether full boot is needed. Stub can access RTC_DATA_ATTR variables.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro