Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

andrew_p
Posts: 30
Joined: Sun Jan 01, 2017 5:37 pm

Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby andrew_p » Wed Feb 08, 2017 2:07 am

I have a small device, which I programmed about a month ago. That device draws about 9.6uA in deep sleep mode. It goes to a deep sleep by one single command:

Code: Select all

esp_deep_sleep_start();
Today I updated ESP_IDF toolchain and the distributive code from github and realized, that the same code(!) on the same circuit(!) now draws 32.64uA in a deep sleep mode.

I'm a bit confused, do I have to power down all peripherals manually before I go to deep sleep?
Is that something what changed somehow since Dec'16? Any specific settings?

(My circuit is just a single ESP-WROOM-32 board)

ESP_Sprite
Posts: 2674
Joined: Thu Nov 26, 2015 4:08 am

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby ESP_Sprite » Wed Feb 08, 2017 8:58 am

Not entirely sure if that wasn't the case earlier on, but we keep the fast RTC ram powered now, in order to quickly resume after a wakeup event (to work around a bug in the current silicon). You can disable that by adding esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF); in your code. Can you try that and see if you still have the increased power draw?

ESP_igrr
Posts: 1460
Joined: Tue Dec 01, 2015 8:37 am

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby ESP_igrr » Wed Feb 08, 2017 12:15 pm

Note that the thing ESP_Sprite has mentioned above hasn't changed since December. What has indeed changed is the default behavior w.r.t the RTC slow memory. If you happen to have any variables with RTC_DATA_ATTR attribute, default behavior now is to keep RTC slow memory powered on. This can be overridden using the same esp_deep_sleep_pd_config function.

Edit: also, would you mind increasing log level to Debug in menuconfig, and pasting here the output printed before the chip enters deep sleep? Thanks.

andrew_p
Posts: 30
Joined: Sun Jan 01, 2017 5:37 pm

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby andrew_p » Wed Feb 08, 2017 3:58 pm

Powering down all peripherals doesn't help. It still draws about 32uA, here is the code I'm testing:

Code: Select all

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "nvs_flash.h"
#include "esp_deep_sleep.h"

void hello_task(void *pvParameter)
{
    printf("Hello world!\n");
    esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
    esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
    esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
    esp_deep_sleep_start();
}

void app_main()
{
    nvs_flash_init();
    xTaskCreate(&hello_task, "hello_task", 2048, NULL, 5, NULL);
}
This is the board (the blue one), I take 3v power supply from sparkfun board:
Image

Image

Here is the log:

Code: Select all

I (46) boot: ESP-IDF v2.0-rc1-26-gc78aa13 2nd stage bootloader
I (47) boot: compile time 10:42:16
I (47) boot: Enabling RNG early entropy source...
I (67) boot: SPI Speed      : 40MHz
I (80) boot: SPI Mode       : DIO
I (92) boot: SPI Flash Size : 4MB
I (104) boot: Partition Table:
I (116) boot: ## Label            Usage          Type ST Offset   Length
I (138) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (162) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (185) boot:  2 factory          factory app      00 00 00010000 00100000
I (208) boot: End of partition table
I (221) boot: Disabling RNG early entropy source...
I (238) boot: Loading app partition at offset 00010000
I (725) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (725) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x06a74 ( 27252) map
I (741) boot: segment 2: paddr=0x00026a84 vaddr=0x3ffb0000 size=0x0245c (  9308) load
I (771) boot: segment 3: paddr=0x00028ee8 vaddr=0x40080000 size=0x00400 (  1024) load
I (794) boot: segment 4: paddr=0x000292f0 vaddr=0x40080400 size=0x13ddc ( 81372) load
I (859) boot: segment 5: paddr=0x0003d0d4 vaddr=0x400c0000 size=0x00034 (    52) load
I (860) boot: segment 6: paddr=0x0003d110 vaddr=0x00000000 size=0x02ef8 ( 12024)
I (878) boot: segment 7: paddr=0x00040010 vaddr=0x400d0018 size=0x21c74 (138356) map
I (905) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (928) heap_alloc_caps: At 3FFB5670 len 0002A990 (170 KiB): DRAM
I (948) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (969) heap_alloc_caps: At 400941DC len 0000BE24 (47 KiB): IRAM
I (990) cpu_start: Pro cpu up.
I (1001) cpu_start: Starting app cpu, entry point is 0x40080a58
I (0) cpu_start: App cpu up.
I (1033) cpu_start: Pro cpu start user code
V (1087) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1088) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (1126) intr_alloc: Connected src 56 to int 2 (cpu 0)
V (1175) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1232) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (1306) intr_alloc: Connected src 16 to int 3 (cpu 0)
V (1354) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1414) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E
D (1490) intr_alloc: Connected src 24 to int 12 (cpu 0)
D (1542) nvs: nvs_flash_init_custom start=9 count=6
D (1637) phy_init: loading PHY init data from application binary
D (1641) nvs: nvs_open phy 0
D (1669) nvs: nvs_get cal_version 4
V (1702) phy_init: phy_get_rf_cal_version: 258

D (1744) nvs: nvs_get_str_or_blob cal_mac
D (1784) nvs: nvs_get_str_or_blob cal_data
D (1835) nvs: nvs_close 1
V (1846) phy_init: register_chipv7_phy, init_data=0x3f401f88, cal_data=0x3ffb6e80, mode=0
I (2046) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
D (2047) nvs: nvs_open phy 1
V (2048) phy_init: phy_get_rf_cal_version: 258

D (2072) nvs: nvs_set cal_version 4 258
D (2112) nvs: nvs_set_blob cal_mac 6
D (2146) nvs: nvs_set_blob cal_data 1904
D (2603) nvs: nvs_close 2
I (2604) cpu_start: Starting scheduler on PRO CPU.
V (1584) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): checking args
V (1584) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): Args okay. Resulting flags 0x40E
D (1594) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (1594) cpu_start: Starting scheduler on APP CPU.
Hello world!
D (1604) deepsleep: RTC_PERIPH: OFF, RTC_SLOW_MEM: OFF, RTC_FAST_MEM: OFF

andrew_p
Posts: 30
Joined: Sun Jan 01, 2017 5:37 pm

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby andrew_p » Wed Feb 08, 2017 4:19 pm

More pictures to compare power consumption in deep sleep mode:

1. This is the board, which has been programmed using Dec'16 toolchain & esp_idf framework
Image

2. This is the board, which has been programmed with hello_world deep sleep example (above) and the most recent toolchain & framework:

Image

andrew_p
Posts: 30
Joined: Sun Jan 01, 2017 5:37 pm

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby andrew_p » Thu Feb 09, 2017 2:20 pm

Can somebody else measure power consumption in deep sleep mode? I'm really curious what's going on...

User avatar
rudi ;-)
Posts: 1293
Joined: Fri Nov 13, 2015 3:25 pm

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby rudi ;-) » Thu Feb 09, 2017 9:31 pm

hi
can you test AT Firmware for a compare?
AT+GSLP=10000
4.png
4.png (17.81 KiB) Viewed 4427 times
goes deep sleep for 10000ms

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

ESP_igrr
Posts: 1460
Joined: Tue Dec 01, 2015 8:37 am

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby ESP_igrr » Thu Feb 09, 2017 10:04 pm

From your last set of pictures I see that 9uA and 32uA values were obtained from different boards. Are these boards using the same flash chips? If you flash same board with two different firmwares, do you still get this difference?

I'll do some measurements by the end of next week, don't have the right board with an isolated module vdd line until then...

andrew_p
Posts: 30
Joined: Sun Jan 01, 2017 5:37 pm

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby andrew_p » Thu Feb 09, 2017 10:59 pm

ESP_igrr wrote:From your last set of pictures I see that 9uA and 32uA values were obtained from different boards. Are these boards using the same flash chips? If you flash same board with two different firmwares, do you still get this difference?

I'll do some measurements by the end of next week, don't have the right board with an isolated module vdd line until then...
Chip is the same in both cases - ESP-WROOM-32. The circuit is the same.

So I just flashed the first board (which showed 9uA on the pictures above) with the most recent esp-idf code/config and now it draws 32uA in deep sleep...

ESP_igrr
Posts: 1460
Joined: Tue Dec 01, 2015 8:37 am

Re: Deep sleep power consumption - has something been changed in the latest ESP_IDF release?

Postby ESP_igrr » Fri Feb 10, 2017 6:25 am

ESP-WROOM32 is a module, which contains an ESP32 chip and a flash chip inside. If you got both modules from the same batch then they should have the same flash chip model, especially given the fact that you get the same 32uA current when flashing new software.
Thanks for the report, I'll get some hardware to measure this at the end of next week, will do git bisect to figure out what went wrong.

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 18 guests