Problem with deep and light sleep

gianmarco_scar
Posts: 3
Joined: Wed Jul 15, 2020 1:59 pm

Problem with deep and light sleep

Postby gianmarco_scar » Tue Aug 25, 2020 1:46 pm

Hi,

I am development an application with ESP32-WROOM-32(M103QH2800PH3Q0) - 16 MB. I have a problem when i using the functions esp_light_sleep_start and esp_deep_sleep_start, the board consumes the same mA regardless if i use the function esp_light_sleep_start or the function esp_deep_sleep_start . Why with the esp_deep_sleep_start function it does not consume less compared to the esp_light_sleep_start function ? Can you help me.

I using the follows code :

void sleep_board ( void )
{
/* Wake up in 2 seconds, or when button is pressed */
esp_sleep_enable_timer_wakeup ( TIME_TO_SLEEP * uS_TO_S_FACTOR ) ;

printf ( "Entering in sleep mode.\n" ) ;
/* To make sure the complete line is printed before entering sleep mode,
* need to wait until UART TX FIFO is empty:
*/
uart_tx_wait_idle ( CONFIG_CONSOLE_UART_NUM ) ;

/* Get timestamp before entering sleep */
int64_t t_before_us = esp_timer_get_time ( ) ;

/* Enter sleep mode */
// ! Note : I use or function esp_light_sleep_start or esp_deep_sleep_start !
esp_light_sleep_start ( ) ;
// esp_deep_sleep_start ( ) ;

/* Execution continues here after wakeup */

/* Get timestamp after waking up from sleep */
int64_t t_after_us = esp_timer_get_time ( ) ;

/* Determine wake up reason */
const char * wakeup_reason ;

switch ( esp_sleep_get_wakeup_cause ( ) )
{
case ESP_SLEEP_WAKEUP_TIMER :
wakeup_reason = "timer" ;
break ;

case ESP_SLEEP_WAKEUP_GPIO :
wakeup_reason = "pin" ;
break ;

default :
wakeup_reason = "other" ;
break ;

}

printf ( "Returned from light sleep, reason: %s, t=%lld ms, slept for %lld ms\n" ,
wakeup_reason , t_after_us / 1000 , ( t_after_us - t_before_us ) / 1000 ) ;

vTaskDelay ( 10 / portTICK_PERIOD_MS ) ;

}

Thanks,

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

Re: Problem with deep and light sleep

Postby ESP_igrr » Mon Aug 31, 2020 1:43 pm

Hi gianmarco_scar,

What is the current consumption of the board after you call esp_light_sleep_start?

Normally in light sleep mode you should be seeing 0.8-1.2 mA, and in deep sleep mode it should be 5-10uA depending on the configured wakeup sources.

If you are seeing the current consumption significantly larger than 1mA in light sleep mode, then it is likely the issue with either of:
1. The chip is not actually entering the sleep mode. You can check this by adding some printf statement before entering sleep, and make sure that this line is printed on UART.
2. There is some other component on the board which draws extra current. Can confirm by running the same program on a bare WROOM-32 module, and measuring its current consumption.
3. There is some leakage current from ESP32 IOs. However this current is usually in uA range, and will not cause higher mA readings in light sleep mode.

If you share your board schematics via the customer support channels, we can review it and give additional advice.

boarchuz
Posts: 559
Joined: Tue Aug 21, 2018 5:28 am

Re: Problem with deep and light sleep

Postby boarchuz » Mon Aug 31, 2020 3:36 pm

ESP_igrr wrote:
Mon Aug 31, 2020 1:43 pm
in deep sleep mode it should be 5-10uA
(to save any confusion)

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

Re: Problem with deep and light sleep

Postby ESP_igrr » Tue Sep 01, 2020 12:21 am

Thanks for noticing boarchuz! Have edited my post.

Who is online

Users browsing this forum: No registered users and 126 guests