Deep Sleep or other power saving functions?

E-M-Dev
Posts: 10
Joined: Sun Apr 02, 2017 3:57 pm

Re: Deep Sleep or other power saving functions?

Postby E-M-Dev » Wed Jun 07, 2017 10:25 pm

I'm using the Rocket 32-Rev1 (silicon rev. 0)

It's strange You need some mods on the sparkfun board.
They claim 2.5µA current in deep sleep for this board.
Attachments
Rocket_32_X.jpg
Rocket_32_X.jpg (147.4 KiB) Viewed 15439 times

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

Re: Deep Sleep or other power saving functions?

Postby ESP_igrr » Thu Jun 08, 2017 7:12 am

kostyan5 wrote:Just a heads up, many boards (including ESP32 WROOM, at least from the schematics available) do not have a pull-up on flash /CS line. This means that when the ESP32 goes to sleep and GPIO is turned off, the /CS line is floating. This prevents the flash from going to standby mode. For my custom board, the deep sleep power consumption dropped from 900uA to 65uA after adding a 100kOhm pullup on the /CS line.
For ESP-WROOM32 this pullup is not needed because the flash chip is powered from ESP32's VDD_SDIO regulator. When ESP32 goes into deep sleep mode, this regulator is powered down.

If you power the flash chip from the same supply rail as the ESP32, you do need this pullup, and the software also has to send powerdown command to the flash chip before entering deep sleep.

kostyan5
Posts: 50
Joined: Mon Mar 06, 2017 3:16 pm

Re: Deep Sleep or other power saving functions?

Postby kostyan5 » Thu Jun 08, 2017 1:56 pm

ESP_igrr wrote: you do need this pullup, and the software also has to send powerdown command to the flash chip before entering deep sleep.
It seems to be working without the powerdown command? How necessary is that command and is there an API to do that?

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

Re: Deep Sleep or other power saving functions?

Postby ESP_igrr » Thu Jun 08, 2017 2:51 pm

kostyan5 wrote:It seems to be working without the powerdown command? How necessary is that command and is there an API to do that?
Depending on the flash chip specs, with powerdown you can get even lower current consumption.
There's no API for this since this hasn't been a very common requirement/feature. It's fairly trivial however. Here's a diff i have laying around, it may not apply directly to the latest code though:

Code: Select all

diff --git a/components/esp32/deep_sleep.c b/components/esp32/deep_sleep.c
index cedf482..d96b508 100644
--- a/components/esp32/deep_sleep.c
+++ b/components/esp32/deep_sleep.c
@@ -25,6 +25,7 @@
 #include "soc/rtc_cntl_reg.h"
 #include "soc/rtc_io_reg.h"
 #include "soc/sens_reg.h"
+#include "soc/spi_reg.h"
 #include "soc/dport_reg.h"
 #include "driver/rtc_io.h"
 #include "freertos/FreeRTOS.h"
@@ -110,6 +111,10 @@ void esp_deep_sleep(uint64_t time_in_us)
 
 void IRAM_ATTR esp_deep_sleep_start()
 {
+    if (esp_get_deep_sleep_wake_stub() == NULL) {
+        esp_set_deep_sleep_wake_stub(esp_wake_deep_sleep);
+    }
+
     // Decide which power domains can be powered down
     uint32_t pd_flags = get_power_down_flags();
 
@@ -133,15 +138,14 @@ void IRAM_ATTR esp_deep_sleep_start()
     // TODO: move timer wakeup configuration into a similar function
     // once rtc_sleep is opensourced.
 
+    WRITE_PERI_REG(SPI_CMD_REG(1), SPI_FLASH_DP_M);
+    while(READ_PERI_REG(SPI_CMD_REG(1))!=0);
+
     // Flush UARTs so that output is not lost due to APB frequency change
     uart_tx_wait_idle(0);
     uart_tx_wait_idle(1);
     uart_tx_wait_idle(2);
 
-    if (esp_get_deep_sleep_wake_stub() == NULL) {
-        esp_set_deep_sleep_wake_stub(esp_wake_deep_sleep);
-    }
-
     rtc_set_cpu_freq(RTC_CPU_FREQ_XTAL);
     uint32_t cycle_h = 0;
     uint32_t cycle_l = 0;

temp4eb
Posts: 35
Joined: Tue Jun 06, 2017 8:59 am

Re: Deep Sleep or other power saving functions?

Postby temp4eb » Fri Jun 09, 2017 12:07 pm

ESP_igrr wrote:
kostyan5 wrote:It seems to be working without the powerdown command? How necessary is that command and is there an API to do that?
Depending on the flash chip specs, with powerdown you can get even lower current consumption.
There's no API for this since this hasn't been a very common requirement/feature. It's fairly trivial however. Here's a diff i have laying around, it may not apply directly to the latest code though:

Code: Select all

diff --git a/components/esp32/deep_sleep.c b/components/esp32/deep_sleep.c
index cedf482..d96b508 100644
--- a/components/esp32/deep_sleep.c
+++ b/components/esp32/deep_sleep.c
@@ -25,6 +25,7 @@
 #include "soc/rtc_cntl_reg.h"
 #include "soc/rtc_io_reg.h"
 #include "soc/sens_reg.h"
+#include "soc/spi_reg.h"
 #include "soc/dport_reg.h"
 #include "driver/rtc_io.h"
 #include "freertos/FreeRTOS.h"
@@ -110,6 +111,10 @@ void esp_deep_sleep(uint64_t time_in_us)
 
 void IRAM_ATTR esp_deep_sleep_start()
 {
+    if (esp_get_deep_sleep_wake_stub() == NULL) {
+        esp_set_deep_sleep_wake_stub(esp_wake_deep_sleep);
+    }
+
     // Decide which power domains can be powered down
     uint32_t pd_flags = get_power_down_flags();
 
@@ -133,15 +138,14 @@ void IRAM_ATTR esp_deep_sleep_start()
     // TODO: move timer wakeup configuration into a similar function
     // once rtc_sleep is opensourced.
 
+    WRITE_PERI_REG(SPI_CMD_REG(1), SPI_FLASH_DP_M);
+    while(READ_PERI_REG(SPI_CMD_REG(1))!=0);
+
     // Flush UARTs so that output is not lost due to APB frequency change
     uart_tx_wait_idle(0);
     uart_tx_wait_idle(1);
     uart_tx_wait_idle(2);
 
-    if (esp_get_deep_sleep_wake_stub() == NULL) {
-        esp_set_deep_sleep_wake_stub(esp_wake_deep_sleep);
-    }
-
     rtc_set_cpu_freq(RTC_CPU_FREQ_XTAL);
     uint32_t cycle_h = 0;
     uint32_t cycle_l = 0;
I tried the deepsleep example on esp_wroom_32 module.The current consumption in deep sleep was about 280uA@3.3V.And I tried to pulled up the /CS and modifid the code according to the above code, the current consumption reduced to 210uA@3.3A, which is much higher than the 20uA in the offical document.I want to know how to modify the code(or hardware?) to get the similar results in offical document.Thanx!

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

Re: Deep Sleep or other power saving functions?

Postby ESP_igrr » Fri Jun 09, 2017 12:12 pm

Could you please describe the connections you have to the module and measurement method? WROOM32 should not need any software mods to achieve 5uA deep sleep current.

E-M-Dev
Posts: 10
Joined: Sun Apr 02, 2017 3:57 pm

Re: Deep Sleep or other power saving functions?

Postby E-M-Dev » Sun Jun 11, 2017 10:24 am

@ESP_igrr Does the changes according to the Hardware Design Guidelines on CHIP EN
with the R10k and C100n apply to the WROOM32 too or I have to implement this separatelly
ie outside of the wroom32 module?

Regards,
Rick

temp4eb
Posts: 35
Joined: Tue Jun 06, 2017 8:59 am

Re: Deep Sleep or other power saving functions?

Postby temp4eb » Mon Jun 12, 2017 2:35 am

ESP_igrr wrote:Could you please describe the connections you have to the module and measurement method? WROOM32 should not need any software mods to achieve 5uA deep sleep current.
Hi ESP_igrr,here is the the connections of the module and measurement method,now the current reduced to about 140uA@3.3V.Thanx!
Deep_Sleep_138uA.jpg
Deep_Sleep_138uA.jpg (1.27 MiB) Viewed 15338 times

E-M-Dev
Posts: 10
Joined: Sun Apr 02, 2017 3:57 pm

Re: Deep Sleep or other power saving functions?

Postby E-M-Dev » Mon Jun 12, 2017 8:25 am

@temp4eb Which silicon revision boards is this?

@all Anybody can confirm the power consumption of silicon revision 1?

Regards,
Rick

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

Re: Deep Sleep or other power saving functions?

Postby ESP_igrr » Mon Jun 12, 2017 9:25 am

It's the same as rev0: 5uA with the default configuration (RTC_FAST_MEM powered on). I have posted measurement results some time ago: https://esp32.com/viewtopic.php?f=2&t=1 ... t=10#p5473

temp4eb: Thanks for the photo... Could you please make a current measurement with CHIP_EN input pulled low?

Who is online

Users browsing this forum: No registered users and 125 guests