I then connect the board to a brand new battery putting out 3.2 Volts. And measure the current using a uCurrent Gold. I get:
Deep Sleep -> 31 uA! Not terrible but < 10 uA from the datasheet would triple my standby lifetime. What is the recipe? Is it my ESP-IDF version, chip version, something in the configuration, or What? I've repeated with 3 chips. Same results. Can someone from Espressif please help guide me through this. Just help me understand what is causing this. I actually repeated the whole experiment on the production board with WiFi etc and the results are the same. So, whatever is going on, it's in the ESP32 device!
Things which helped get to this point:
- esp_wifi_stop(); // had a significant impact when using the full code with WiFi. But crashes when no WiFi.
- rtc_gpio_isolate(GPIO_NUM_12); // GPIOs which have external pull ups (removed for now).
- rtc_gpio_isolate(GPIO_NUM_26); // GPIOs which have external pull ups (removed for now).
- rtc_gpio_isolate(GPIO_NUM_27); // GPIOs which have external pull ups (removed for now).
- void app_main()
- {
- goToDeepSleep(0);
- }
- void goToDeepSleep(uint32_t sleep_time) {
- ESP_LOGI(TAG, "Going to sleep...");
- // not actually needed since bluedroid not enabled
- // esp_bluedroid_disable();
- // esp_bluedroid_deinit();
- // Makes no difference
- esp_bt_controller_disable();
- esp_bt_controller_deinit();
- adc_power_off();
- rtc_gpio_isolate(GPIO_NUM_2);
- rtc_gpio_isolate(GPIO_NUM_12);
- rtc_gpio_isolate(GPIO_NUM_13);
- rtc_gpio_isolate(GPIO_NUM_26);
- rtc_gpio_isolate(GPIO_NUM_27);
- // Does make a difference!
- // esp_wifi_stop();
- // Power Down RTC Domains! should get from 150 uA to 10 uA! Actually does nothing.
- esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
- esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
- esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
- // Configure the timer to wake us up!
- if (sleep_time > 0) {
- esp_sleep_enable_timer_wakeup(sleep_time);
- }
- // Go to sleep! Zzzz
- esp_deep_sleep_start();
- }
.rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6804
load:0x40078000,len:12040
load:0x40080400,len:6708
entry 0x40080778
I (72) boot: Chip Revision: 3
I (73) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (40) boot: ESP-IDF v3.3-202-gefdddbb25-dirty 2nd stage bootloader
I (40) boot: compile time 13:19:07
I (40) boot: Enabling RNG early entropy source...
I (46) boot: SPI Speed : 40MHz
I (50) boot: SPI Mode : DIO
I (54) boot: SPI Flash Size : 4MB
I (58) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 otadata OTA data 01 00 0000f000 00002000
I (84) boot: 2 phy_init RF data 01 01 00011000 00001000
I (92) boot: 3 ota_0 OTA app 00 10 00020000 00190000
I (99) boot: 4 ota_1 OTA app 00 11 001b0000 00190000
I (107) boot: 5 fctry WiFi data 01 02 00340000 00006000
I (114) boot: End of partition table
I (118) boot_comm: chip revision: 3, min. application chip revision: 0
I (126) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x09940 ( 39232) map
I (148) esp_image: segment 1: paddr=0x00029968 vaddr=0x3ffbdb60 size=0x02124 ( 8484) load
I (152) esp_image: segment 2: paddr=0x0002ba94 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _WindowOverflow4 at C:/msys32/home/thebi/esp/esp-idf/components/freertos/xtensa_vectors.S:1779
I (156) esp_image: segment 3: paddr=0x0002be9c vaddr=0x40080400 size=0x04174 ( 16756) load
I (171) esp_image: segment 4: paddr=0x00030018 vaddr=0x400d0018 size=0x2be5c (179804) map
0x400d0018: _stext at ??:?
I (236) esp_image: segment 5: paddr=0x0005be7c vaddr=0x40084574 size=0x0cf7c ( 53116) load
0x40084574: esp_ptr_in_diram_dram at C:/msys32/home/thebi/esp/esp-idf/components/heap/heap_caps.c:196
(inlined by) dram_alloc_to_iram_addr at C:/msys32/home/thebi/esp/esp-idf/components/heap/heap_caps.c:43
I (258) esp_image: segment 6: paddr=0x00068e00 vaddr=0x400c0000 size=0x00064 ( 100) load
I (269) boot: Loaded app from partition at offset 0x20000
I (269) boot: Disabling RNG early entropy source...
I (270) cpu_start: Pro cpu up.
I (274) cpu_start: Application information:
I (279) cpu_start: Project name: sn_wi_003
I (284) cpu_start: App version: 3f2f1bf-dirty
I (289) cpu_start: Compile time: May 9 2020 13:19:32
I (295) cpu_start: ELF file SHA256: c27a8e67c6214aee...
I (301) cpu_start: ESP-IDF: v3.3-202-gefdddbb25-dirty
I (308) cpu_start: Single core mode
I (312) heap_init: Initializing. RAM available for dynamic allocation:
I (319) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (325) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (331) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (337) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (344) heap_init: At 3FFC1970 len 0001E690 (121 KiB): DRAM
I (350) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (356) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (362) heap_init: At 400914F0 len 0000EB10 (58 KiB): IRAM
I (369) cpu_start: Pro cpu start user code
I (387) cpu_start: Starting scheduler on PRO CPU.
I (388) app_main: Going to sleep..