Page 1 of 1

ESP32 deep sleep for 6+ hours

Posted: Thu Aug 22, 2024 7:40 am
by tuadru
Im having trouble with my putting my esp32 to sleep for over 1 hour.
For 1 hour it works but when I try for 6 hours it wakes up every 3-4 minutes or so.

Code: Select all

//ABOVE SETUP
#define uS_TO_S_FACTOR 1000000UL  /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP  21600       /* Time ESP32 will go to sleep (in seconds) */
uint64_t u64SleepLength = TIME_TO_SLEEP * uS_TO_S_FACTOR;/* Time ESP32 will go to sleeps */

//SETUP FUNCTION
esp_sleep_enable_timer_wakeup(u64SleepLength);

//LOOP FUNCTION
esp_deep_sleep_start();
Any suggestion would be greatly appriciated.

Re: ESP32 deep sleep for 6+ hours

Posted: Thu Aug 22, 2024 8:10 am
by ESP_Sprite
Potentially an overflow... try 1000000ULL instead of 1000000UL?

Re: ESP32 deep sleep for 6+ hours

Posted: Mon Aug 26, 2024 5:50 am
by tuadru
Yeah this was it, I thought if I store it into uint64 it doesn't overflow but I guess it doesn't matter. Thanks.