Board: ESP32 Dev Module
Core Installation/update date: 16/jun/2020
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
when wake stub starts I want to know how much time ESP32 spend in deep sleep, how can I achieve this I tried below code in wake stub but always get 0 in return.
Code: Select all
static const char RTC_RODATA_ATTR now_str[] = "now=%ld\n";
// Get current RTC time
SET_PERI_REG_MASK(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_UPDATE);
while (GET_PERI_REG_MASK(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_VALID) == 0) {
ets_delay_us(1);
}
SET_PERI_REG_MASK(RTC_CNTL_INT_CLR_REG, RTC_CNTL_TIME_VALID_INT_CLR);
uint64_t now = READ_PERI_REG(RTC_CNTL_TIME0_REG);
now |= ((uint64_t)READ_PERI_REG(RTC_CNTL_TIME1_REG)) << 32;
ets_printf(now_str,now); // print always 0 here