From 417711c390d2a5e1ba6c2b7cd469ffd0ff437f6e Mon Sep 17 00:00:00 2001 From: jingli Date: Fri, 3 Dec 2021 21:01:02 +0800 Subject: [PATCH] reduce bootup time when using usb-serial-jtag --- components/soc/src/esp32s2/rtc_time.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/soc/src/esp32s2/rtc_time.c b/components/soc/src/esp32s2/rtc_time.c index b220c0c550..064b984683 100644 --- a/components/soc/src/esp32s2/rtc_time.c +++ b/components/soc/src/esp32s2/rtc_time.c @@ -64,6 +64,11 @@ uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles) * so we should wait the last process is done. */ if (GET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_START_CYCLING)) { + /** + * Set a small timeout threshold to accelerate the generation of timeout. + * The internal circuit will be reset when the timeout occurs and will not affect the next calibration. + */ + REG_SET_FIELD(TIMG_RTCCALICFG2_REG(0), TIMG_RTC_CALI_TIMEOUT_THRES, 1); while (!GET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_RDY) && !GET_PERI_REG_MASK(TIMG_RTCCALICFG2_REG(0), TIMG_RTC_CALI_TIMEOUT)); }