Merge branch 'bugfix/light_sleep_when_rtc_is_used_for_gettimeofday' into 'master'
esp_hw_support: Fix time spent in light sleep when RTC is used for gettimeofday See merge request espressif/esp-idf!17740
This commit is contained in:
@@ -61,14 +61,16 @@ void app_main(void)
|
||||
/* Timekeeping continues in light sleep, and timers are scheduled
|
||||
* correctly after light sleep.
|
||||
*/
|
||||
ESP_LOGI(TAG, "Entering light sleep for 0.5s, time since boot: %lld us",
|
||||
esp_timer_get_time());
|
||||
int64_t t1 = esp_timer_get_time();
|
||||
ESP_LOGI(TAG, "Entering light sleep for 0.5s, time since boot: %lld us", t1);
|
||||
|
||||
ESP_ERROR_CHECK(esp_sleep_enable_timer_wakeup(500000));
|
||||
esp_light_sleep_start();
|
||||
|
||||
ESP_LOGI(TAG, "Woke up from light sleep, time since boot: %lld us",
|
||||
esp_timer_get_time());
|
||||
int64_t t2 = esp_timer_get_time();
|
||||
ESP_LOGI(TAG, "Woke up from light sleep, time since boot: %lld us", t2);
|
||||
|
||||
assert(abs((t2 - t1) - 500000) < 1000);
|
||||
|
||||
/* Let the timer run for a little bit more */
|
||||
usleep(2000000);
|
||||
|
||||
@@ -30,6 +30,13 @@ ONE_SHOT_TIMER_PERIOD = 5000000
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'rtc',
|
||||
],
|
||||
indirect=True
|
||||
)
|
||||
def test_esp_timer(dut: Dut) -> None:
|
||||
|
||||
match = dut.expect(STARTING_TIMERS_REGEX)
|
||||
|
||||
10
examples/system/esp_timer/sdkconfig.ci.rtc
Normal file
10
examples/system/esp_timer/sdkconfig.ci.rtc
Normal file
@@ -0,0 +1,10 @@
|
||||
# For ESP32-S3 and ESP32-C3, keep secondary console disabled
|
||||
# This is to avoid any timing impact on test behavior
|
||||
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
|
||||
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC=y
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC=y
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC=y
|
||||
CONFIG_ESP32C2_TIME_SYSCALL_USE_RTC=y
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_RTC=y
|
||||
CONFIG_ESP32H2_TIME_SYSCALL_USE_RTC=y
|
||||
Reference in New Issue
Block a user