Problem with deep and light sleep
Posted: 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,
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,