Code: Select all
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "esp_sleep.h"
#include "driver/rtc_io.h"
#define LED_GPIO 5
#define SENSOR_GPIO 27
void app_main() {
printf("Start\n");
printf("Config\n");
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_AUTO); // power domain enabled in deep sleep
rtc_gpio_pullup_en(SENSOR_GPIO); // enable pullup on GPIO
rtc_gpio_pulldown_dis(SENSOR_GPIO); // disable pulldown on GPIO
esp_sleep_enable_ext0_wakeup(SENSOR_GPIO, 0); // Wake-up if GPIO is low
printf("Entering deep sleep\n");
esp_deep_sleep_start();
}
Code: Select all
I (11) boot: ESP-IDF v3.2-dev-106-gfdee0b64 2nd stage bootloader
I (11) boot: compile time 13:57:24
I (11) boot: Enabling RNG early entropy source...
I (16) boot: SPI Speed : 40MHz
I (20) boot: SPI Mode : DIO
I (24) boot: SPI Flash Size : 4MB
I (28) boot: Partition Table:
I (31) boot: ## Label Usage Type ST Offset Length
I (39) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (46) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (54) boot: 2 factory factory app 00 00 00010000 00100000
I (61) boot: End of partition table
I (65) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0653c ( 25916) map
I (83) esp_image: segment 1: paddr=0x00016564 vaddr=0x3ffb0000 size=0x022e0 ( 8928) load
I (87) esp_image: segment 2: paddr=0x0001884c vaddr=0x3ffb22e0 size=0x00000 ( 0) load
I (92) esp_image: segment 3: paddr=0x00018854 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at D:/msys32/home/asdf/esp/esp-idf/components/freertos/xtensa_vectors.S:1685
I (101) esp_image: segment 4: paddr=0x00018c5c vaddr=0x40080400 size=0x073b4 ( 29620) load
I (122) esp_image: segment 5: paddr=0x00020018 vaddr=0x400d0018 size=0x1231c ( 74524) map
0x400d0018: _flash_cache_start at ??:?
I (148) esp_image: segment 6: paddr=0x0003233c vaddr=0x400877b4 size=0x01db4 ( 7604) load
0x400877b4: rtc_clk_32k_bootstrap at D:/msys32/home/asdf/esp/esp-idf/components/soc/esp32/rtc_clk.c:445
I (152) esp_image: segment 7: paddr=0x000340f8 vaddr=0x400c0000 size=0x00064 ( 100) load
I (155) esp_image: segment 8: paddr=0x00034164 vaddr=0x50000000 size=0x00000 ( 0) load
I (170) boot: Loaded app from partition at offset 0x10000
I (170) boot: Disabling RNG early entropy source...
I (176) cpu_start: Pro cpu up.
I (179) cpu_start: Starting app cpu, entry point is 0x40080f14
0x40080f14: call_start_cpu1 at D:/msys32/home/asdf/esp/esp-idf/components/esp32/cpu_start.c:225
I (0) cpu_start: App cpu up.
I (190) heap_init: Initializing. RAM available for dynamic allocation:
I (197) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (203) heap_init: At 3FFB3330 len 0002CCD0 (179 KiB): DRAM
I (209) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (215) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (222) heap_init: At 40089568 len 00016A98 (90 KiB): IRAM
I (228) cpu_start: Pro cpu start user code
I (246) cpu_start: Startin