Validate Hibernate Mode into ESP32

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

Re: Validate Hibernate Mode into ESP32

Postby ESP_Sprite » Fri Dec 23, 2016 6:03 am

Yes, it is.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Validate Hibernate Mode into ESP32

Postby Ritesh » Fri Dec 23, 2016 5:51 pm

ry1234 wrote:
ESP_igrr wrote:One more note: it is possible to power down RTC fast memory (it just is kept powered on by default). If you do so with the current chip revision, it will resume from deep sleep but will experience a watchdog reset and then proceed to normal boot. This extra time spent waiting for wdt reset may cancel out the savings achieved by powering off the fast memory, depending on the duty cycle of your application.
Hi -
Is the watchdog reset issue when waking up from hibernate mode (RTC fast mem powered down) going to be fixed in the next revision of the silicon early 2017?

Thanks
Hi,

I just want to know what is happened after waking up from deep sleep mode as there is no any API support for hibernate mode?

Watchdog reset is caused after waking up from deep sleep mode?

It's due to hardware issues as I haven't checked with API yet?

Please let me know if you have more informations for that..
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Validate Hibernate Mode into ESP32

Postby Ritesh » Sun Dec 25, 2016 11:46 am

Hi,

I have checked deep sleep mode using esp_deep_sleep(30000000); API and the module is going into deep sleep mode as my WiFi connection is broken after entering module into deep sleep mode and module is also waken up after configured time as 30 seconds in my example.

But, I am getting panic issue after waking up module from deep sleep and system restarted due to that panic issue.
ets Jun 8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0008,len:4
load:0x3ffc000c,len:1880
load:0x40078000,len:3408
ho 0 tail 12 room 4
load:0x40080000,len:260
entry 0x40080034
I (719) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (719) heap_alloc_caps: At 3FFC10F8 len 0001EF08 (123 KiB): DRAM
I (724) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (735) heap_alloc_caps: At 00080000 len 00002000 (8 KiB): IRAM
I (745) heap_alloc_caps: At 4009B868 len 00004798 (17 KiB): IRAM
/media/debain64/home/sysadmin/Project_Data/HHT_Project/ESP32_SDK/esp-idf/components/freertos/./heap_regions.c:531 (vPortDefineHeapRegionsTagged)- assert failed!
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception)
Register dump:
PC : 0x40009203 PS : 0x00060736 A0 : 0x00000000 A1 : 0x3ffe3bf0
A2 : 0x000000a1 A3 : 0x000000a1 A4 : 0x00000010 A5 : 0xffffffff
A6 : 0x00000000 A7 : 0xffffffe3 A8 : 0x00000000 A9 : 0x3ffe3b60
A10 : 0x00000000 A11 : 0x3f4042d8 A12 : 0x3ffe3b2f A13 : 0x00000031
A14 : 0x00000000 A15 : 0x3ffe3b34 SAR : 0x00000004 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000

Backtrace: 0x40009203:0x3ffe3bf0 0x00000000:0x3ffe3c10 0x400d108a:0x3ffe3c30 0x40080a96:0x3ffe3c60 0x40078369:0x3ffe3ca0 0x400784e6:0x3ffe3cd0 0x4007878e:0x3ffe3d50 0x40080101:0x3ffe3e70 0x40007c34:0x3ffe0

.
ets Jun 8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0008,len:4
load:0x3ffc000c,len:1880
load:0x40078000,len:3408
ho 0 tail 12 room 4
load:0x40080000,len:260
entry 0x40080034
I (719) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (719) heap_alloc_caps: At 3FFC10F8 len 0001EF08 (123 KiB): DRAM
I (724) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (734) heap_alloc_caps: At 4009B868 len 00004798 (17 KiB): IRAM
I (745) cpu_start: Pro cpu up.
I (750) cpu_start: Single core mode
I (757) cpu_start: Pro cpu start user code
I (960) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (1409) cpu_start: Starting scheduler on PRO CPU.
But when I have checked deep sleep without initializing WiFi at that time I am not getting any panic issue and module is waken up from deep sleep mode only without any system restart issue.

I have also tried to stop WiFi and deinit wifi using APIs before invoking system deep sleep API but still getting panic issue due to some heap memory issue.

Code: Select all

TaskHandle_t deep_sleep_task_handler;

void deep_sleep_task(void *pvParameters)
{
	ESP_LOGI(TAG, "********* deep_sleep_task started ***********");
	
	vTaskDelay(30000 / portTICK_RATE_MS);
	
	ESP_LOGI(TAG, "********* deep_sleep_task after 30 seconds delay ***********");
	
	ESP_ERROR_CHECK( esp_wifi_stop() );
	ESP_ERROR_CHECK( esp_wifi_deinit() );
	
	esp_deep_sleep(30000000); /// Module should be wake up after 30 seconds of interval
	
	vTaskDelete(deep_sleep_task_handler);
}

static void initialise_wifi(void)
{
	uint8_t mac[6];
	
	ESP_LOGI(TAG, "********* initialise_wifi started ***********");
	
	tcpip_adapter_init();
	ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
    ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
    
	ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_AP) );	/// Added to check only AP mode
    esp_efuse_read_mac(mac); /// In ESP32 STATION MAC Address is Hardware MAC Address 
    ESP_LOGI(TAG, "********** STATION MAC Address :: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
	ESP_LOGI(TAG, "********** AP MAC Address :: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]+1);
    
    wifi_config_t ap_config = {
		.ap = {
			.password = AP_PASSWORD,
			.ssid_len = 0,
			.channel = 6,
			.authmode = WIFI_AUTH_WPA_WPA2_PSK,
			.max_connection = 4,
			//.ssid_hidden = 1, /// SSID will be hidden means manually need to add SSID and Password to connect to that device
			.ssid_hidden = 0,	/// Default SSID is not hidden means broadcasted
		}
    };
    
    sprintf(ap_config.ap.ssid, "ESP_%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]+1);
    
    ESP_LOGI(TAG, "Setting AP WiFi configuration SSID %s...", ap_config.ap.ssid);
    ESP_LOGI(TAG, "Setting AP WiFi configuration password %s...", ap_config.ap.password);
    ESP_LOGI(TAG, "Setting AP WiFi configuration max_connection %d...", ap_config.ap.max_connection);
    ESP_LOGI(TAG, "Setting AP WiFi configuration ssid_len %d...", ap_config.ap.ssid_len);
    ESP_LOGI(TAG, "Setting AP WiFi configuration channel %d...", ap_config.ap.channel);
    ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_AP, &ap_config) );  
    ESP_ERROR_CHECK( esp_wifi_start() );
    
    ESP_LOGI(TAG, "********* initialise_wifi completed ***********");
    
    ESP_LOGI(TAG, "esp_get_free_heap_size after initialise_wifi :: %d", esp_get_free_heap_size());
}

void app_main(void)
{
    nvs_flash_init();
    system_init();
 
    initialise_wifi();

    /// Task to enter module into deep sleep mode after 30 seconds
    xTaskCreatePinnedToCore(&deep_sleep_task, "deep_sleep_task", 2048, NULL, 5, &deep_sleep_task_handler, 0);
}
Please let me know if anyone has used esp_deep_sleep API to enter module into deep sleep mode.
Regards,
Ritesh Prajapati

rousveiga
Posts: 1
Joined: Thu Dec 03, 2020 11:56 am

Re: Validate Hibernate Mode into ESP32

Postby rousveiga » Thu Dec 03, 2020 12:02 pm

This page: https://lastminuteengineers.com/esp32-s ... ation-mode is where I found the hibernation mode referenced. I'm guessing the writer got the ESP32 confused with a different micro, since there are some that do have that mode.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Validate Hibernate Mode into ESP32

Postby Ritesh » Wed Dec 09, 2020 5:00 am

rousveiga wrote:
Thu Dec 03, 2020 12:02 pm
This page: https://lastminuteengineers.com/esp32-s ... ation-mode is where I found the hibernation mode referenced. I'm guessing the writer got the ESP32 confused with a different micro, since there are some that do have that mode.
Ok. Thanks for the details for the same.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 63 guests