Skip to content

Commit 8bd2287

Browse files
committed
Merge branch 'fix/increase_26mhz_esp32c2_slow_clock_calibration_wdt_threshold_v5.3' into 'release/v5.3'
fix(esp_system): increase 26Mhz esp32c2 slow clock calibration timeout watchdog threshold (v5.3) See merge request espressif/esp-idf!30575
2 parents aa1c3af + ccca8b7 commit 8bd2287

File tree

1 file changed

+7
-2
lines changed
  • components/esp_system/port/soc/esp32c2

1 file changed

+7
-2
lines changed

components/esp_system/port/soc/esp32c2/clk.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,16 @@ __attribute__((weak)) void esp_clk_init(void)
7777
#ifdef CONFIG_BOOTLOADER_WDT_ENABLE
7878
// WDT uses a SLOW_CLK clock source. After a function select_rtc_slow_clk a frequency of this source can changed.
7979
// If the frequency changes from 150kHz to 32kHz, then the timeout set for the WDT will increase 4.6 times.
80-
// Therefore, for the time of frequency change, set a new lower timeout value (1.6 sec).
80+
// Therefore, for the time of frequency change, set a new lower timeout value (1.6 sec on 40MHz XTAL and 2.5 sec on 26MHz XTAL).
8181
// This prevents excessive delay before resetting in case the supply voltage is drawdown.
82-
// (If frequency is changed from 150kHz to 32kHz then WDT timeout will increased to 1.6sec * 150/32 = 7.5 sec).
82+
// (If frequency is changed from 150kHz to 32kHz then WDT timeout will increased to 1.6sec * 150/32 = 7.5 sec 40MHz XTAL,
83+
// or 11.72 sec on 26MHz XTAL).
8384
wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
85+
#ifdef CONFIG_XTAL_FREQ_26
86+
uint32_t stage_timeout_ticks = (uint32_t)(2500ULL * rtc_clk_slow_freq_get_hz() / 1000ULL);
87+
#else
8488
uint32_t stage_timeout_ticks = (uint32_t)(1600ULL * rtc_clk_slow_freq_get_hz() / 1000ULL);
89+
#endif
8590
wdt_hal_write_protect_disable(&rtc_wdt_ctx);
8691
wdt_hal_feed(&rtc_wdt_ctx);
8792
//Bootloader has enabled RTC WDT until now. We're only modifying timeout, so keep the stage and timeout action the same

0 commit comments

Comments
 (0)