File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
components/esp_system/port/soc/esp32c2 Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments