- esptool.py v2.6
- Serial port COM3
- Connecting........_
- Chip is ESP32D0WDQ6 (revision 1)
- Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
- MAC: a4:cf:12:6c:29:78
- Uploading stub...
- Running stub...
- Stub running...
- Changing baud rate to 921600
- Changed.
- Configuring flash size...
- Auto-detected Flash size: 4MB
- Compressed 8192 bytes to 47...
- Writing at 0x0000e000... (100 %)
- Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 1489.5 kbit/s)...
- Hash of data verified.
- Compressed 17392 bytes to 11186...
- Writing at 0x00001000... (100 %)
- Wrote 17392 bytes (11186 compressed) at 0x00001000 in 0.2 seconds (effective 843.2 kbit/s)...
- Hash of data verified.
- Compressed 224848 bytes to 113845...
- Writing at 0x00010000... (14 %)
- Writing at 0x00014000... (28 %)
- Writing at 0x00018000... (42 %)
- Writing at 0x0001c000... (57 %)
- Writing at 0x00020000... (71 %)
- Writing at 0x00024000... (85 %)
- Writing at 0x00028000... (100 %)
- Wrote 224848 bytes (113845 compressed) at 0x00010000 in 1.7 seconds (effective 1055.0 kbit/s)...
- Hash of data verified.
- Compressed 3072 bytes to 128...
- Writing at 0x00008000... (100 %)
- Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.0 seconds (effective 546.1 kbit/s)...
- Hash of data verified.
- Leaving...
- Hard resetting via RTS pin...
- []Board: ESP32 DevKit V1
- Core Installation version: 1.0.4 (Board Manager ESP32 by Espressif Systems)
- IDE name: Arduino 1.8.12
- Flash Frequency: 80MHz
- PSRAM enabled: No
- Upload Speed: 921600
- Computer OS: Windows 10 1909
I tried to get a bit into the deep sleep states of the ESP32 and waking it up by an timer interupt. For this, I chose to try out the sample provided under Files -> Examples -> ESP32 -> DeepSleep -> TimerWakeUp, flashed it successfully to the board (at least so I assume, works for other small projects as well) and started it up. As it unfortuanitly seems, after calling esp_deep_sleep_start(); the ESP32 is not waking up again. I tried a bit around with short time periods (e.g. 1 second), but that did not produce any other results than the board not.
The ESP32 is connected via a Micro-USB to USB-A cable to my computer, both as the data line for the Serial Monitor and flashing as well as the power source. No further components are connected to the microcontroller. Other functionalities such as WiFi or networking (using MQTT) is working fine. I don't have a second ESP32 module, so cannot verify this behaviour with other hardware sadly.
What am I doing wrong / not seeing? Anything wrong with my settings? Not having installed any the necessary libraries?
Code
- #define uS_TO_S_FACTOR 1000000ULL /* Conversion factor for micro seconds to seconds */
- #define TIME_TO_SLEEP 5 /* Time ESP32 will go to sleep (in seconds) */
- RTC_DATA_ATTR int bootCount = 0;
- /*
- Method to print the reason by which ESP32
- has been awaken from sleep
- */
- void print_wakeup_reason(){
- esp_sleep_wakeup_cause_t wakeup_reason;
- wakeup_reason = esp_sleep_get_wakeup_cause();
- switch(wakeup_reason)
- {
- case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); break;
- case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
- case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break;
- case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break;
- case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break;
- default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break;
- }
- }
- void setup(){
- Serial.begin(115200);
- delay(1000); //Take some time to open up the Serial Monitor
- ++bootCount;
- Serial.println("Boot number: " + String(bootCount));
- print_wakeup_reason();
- esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
- Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) +
- " Seconds");
- //esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
- //Serial.println("Configured all RTC Peripherals to be powered down in sleep");
- Serial.println("Going to sleep now");
- Serial.flush();
- esp_deep_sleep_start();
- Serial.println("This will never be printed");
- }
- void loop(){ //This is not going to be called }
- 10:09:54.910 -> ets Jun 8 2016 00:22:57
- 10:09:54.943 ->
- 10:09:54.943 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
- 10:09:54.943 -> configsip: 0, SPIWP:0xee
- 10:09:54.943 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
- 10:09:54.943 -> mode:DIO, clock div:1
- 10:09:54.943 -> load:0x3fff0018,len:4
- 10:09:54.943 -> load:0x3fff001c,len:1216
- 10:09:54.943 -> ho 0 tail 12 room 4
- 10:09:54.943 -> load:0x40078000,len:9720
- 10:09:54.943 -> ho 0 tail 12 room 4
- 10:09:54.943 -> load:0x40080400,len:6352
- 10:09:54.943 -> entry 0x400806b8
- 10:09:56.090 -> Boot number: 1
- 10:09:56.090 -> Wakeup was not caused by deep sleep: 0
- 10:09:56.090 -> Setup ESP32 to sleep for every 5 Seconds
- 10:09:56.090 -> Going to sleep now