]> granicus.if.org Git - esp-idf/commitdiff
examples/ulp: disable pullup on GPIO15 to reduce current
authorIvan Grokhotkov <ivan@espressif.com>
Fri, 3 Nov 2017 06:01:33 +0000 (14:01 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Fri, 3 Nov 2017 10:56:31 +0000 (18:56 +0800)
Also increase sampling frequency in ulp_adc example and update READMEs.

Fixes https://github.com/espressif/esp-idf/issues/1108

examples/system/ulp/README.md
examples/system/ulp/main/ulp_example_main.c
examples/system/ulp_adc/README.md
examples/system/ulp_adc/main/ulp_adc_example_main.c

index a965736d5f557d9c82d7d4c42aeb88f74d754bad..17ba58f21e379802940d80dbe1f3083986ddc44f 100644 (file)
@@ -45,6 +45,6 @@ Wrote updated pulse count to NVS:   405
 Entering deep sleep
 ```
 
-Note that in one case the pulse count captured by the ULP program is 6, even though the `edge_count_to_wake_up` variable is set to 10 by the main program. This shows that the ULP program keeps track of pulses while the main CPUs are starting up, so when pulses are sent rapidly it is possible to register more pulses between wake up and entry into app_main. 
+Note that in one case the pulse count captured by the ULP program is 6, even though the `edge_count_to_wake_up` variable is set to 10 by the main program. This shows that the ULP program keeps track of pulses while the main CPUs are starting up, so when pulses are sent rapidly it is possible to register more pulses between wake up and entry into app_main.
 
\ No newline at end of file
+With the default configuration (20ms ULP wakeup period), average current consumption in deep sleep mode is 16uA.
index ede8813d2535bcc631f733f471ae3a4aa09ce930..650744e886344f0a889034d7d1d74bd36eeae1fa 100644 (file)
@@ -68,6 +68,12 @@ static void init_ulp_program()
     rtc_gpio_pullup_dis(gpio_num);
     rtc_gpio_hold_en(gpio_num);
 
+    /* Disable pullup on GPIO15, in case it is connected to ground to suppress
+     * boot messages.
+     */
+    rtc_gpio_pullup_dis(GPIO_NUM_15);
+    rtc_gpio_hold_en(GPIO_NUM_15);
+
     /* Set ULP wake up period to T = 20ms (3095 cycles of RTC_SLOW_CLK clock).
      * Minimum pulse width has to be T * (ulp_debounce_counter + 1) = 80ms.
      */
index a8d6033618dfd83a4fd84a38c1d72150dc977568..f07cf0fc775959f587813b53c50304d7a476becd 100644 (file)
@@ -6,11 +6,19 @@ ULP program periodically measures the input voltage on GPIO34. The voltage is co
 
 By default, thresholds are set to 1.35V and 1.75V, approximately.
 
-Average current drawn by the ESP32 in this example with the default configuration (10Hz measurement period, 4x averaging) is 80 uA.
+GPIO15 is connected to ground to supress output from ROM bootloader.
+
+Average current drawn by the ESP32 in this example (with the default 4x averaging) depending on the measurement frequency is as follows:
+
+Measurement frequency, Hz | Average current, uA
+--------------------------|---------------------
+  10                      | 8.5
+  50                      | 20
+ 100                      | 37
 
 ## Example output
 
-Below is the output from this example. GPIO15 is pulled down to ground to supress output from ROM bootloader.
+Below is the output from this example.
 
 ```
 Not ULP wakeup
index 630c29eb68d3a5c3f367919e0ce66ca00e6d0728..5e43ca22dc8f3624c8128684e03cad414fddfc10 100644 (file)
@@ -71,8 +71,14 @@ static void init_ulp_program()
     ulp_low_thr = 1500;
     ulp_high_thr = 2000;
 
-    /* Set ULP wake up period to 100ms */
-    ulp_set_wakeup_period(0, 100000);
+    /* Set ULP wake up period to 20ms */
+    ulp_set_wakeup_period(0, 20000);
+
+    /* Disable pullup on GPIO15, in case it is connected to ground to suppress
+     * boot messages.
+     */
+    rtc_gpio_pullup_dis(GPIO_NUM_15);
+    rtc_gpio_hold_en(GPIO_NUM_15);
 }
 
 static void start_ulp_program()