From 1db2e04c210b8cbab341a511b42320e6e909da5a Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Tue, 9 Jun 2026 17:00:58 +0800 Subject: [PATCH] fix(iwdt): increased default timeout if using PSRAM Default timeout for interrupt WDT was increased by default on ESP32, due to some heap integrity check APIs taking a long time on large PSRAMs and causing timeouts. But this adjustment was only done for ESP32, not later chips, even though they may experience the same issue. Adjusted to have the same behavior on all chips with PSRAM enabled, making it consistant with the docs. Closes https://github.com/espressif/esp-idf/issues/18360 --- components/esp_system/Kconfig | 4 ++-- docs/en/api-reference/system/wdts.rst | 6 ++++-- docs/zh_CN/api-reference/system/wdts.rst | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/components/esp_system/Kconfig b/components/esp_system/Kconfig index 6ae836f62c7..71ad3b87356 100644 --- a/components/esp_system/Kconfig +++ b/components/esp_system/Kconfig @@ -281,8 +281,8 @@ menu "ESP System Settings" config ESP_INT_WDT_TIMEOUT_MS int "Interrupt watchdog timeout (ms)" depends on ESP_INT_WDT - default 300 if !(SPIRAM && IDF_TARGET_ESP32) - default 800 if (SPIRAM && IDF_TARGET_ESP32) + default 300 if !SPIRAM + default 800 if SPIRAM range 10 10000 help The timeout of the watchdog, in milliseconds. Make this higher than the FreeRTOS tick rate. diff --git a/docs/en/api-reference/system/wdts.rst b/docs/en/api-reference/system/wdts.rst index a72e227e3f8..8fdcc100e0a 100644 --- a/docs/en/api-reference/system/wdts.rst +++ b/docs/en/api-reference/system/wdts.rst @@ -74,8 +74,10 @@ Configuration - The IWDT is enabled by default via the :ref:`CONFIG_ESP_INT_WDT` option. - The IWDT's timeout is configured by setting the :ref:`CONFIG_ESP_INT_WDT_TIMEOUT_MS` option. - - Note that the default timeout is higher if PSRAM support is enabled, as a critical section or interrupt routine that accesses a large amount of PSRAM takes longer to complete in some circumstances. - - The configured timeout duration for IWDT should always be at least twice longer than the period between two FreeRTOS ticks, e.g., if two FreeRTOS ticks occur 10 ms apart, then IWDT timeout duration should at least be more than 20 ms (see :ref:`CONFIG_FREERTOS_HZ`). + .. list:: + + :SOC_SPIRAM_SUPPORTED: - Note that the default timeout is higher if PSRAM support is enabled, as a critical section or interrupt routine that accesses a large amount of PSRAM takes longer to complete in some circumstances. + - The configured timeout duration for IWDT should always be at least twice longer than the period between two FreeRTOS ticks, e.g., if two FreeRTOS ticks occur 10 ms apart, then IWDT timeout duration should at least be more than 20 ms (see :ref:`CONFIG_FREERTOS_HZ`). Tuning ^^^^^^ diff --git a/docs/zh_CN/api-reference/system/wdts.rst b/docs/zh_CN/api-reference/system/wdts.rst index 8aea9f609bb..b1bd2d7f1ce 100644 --- a/docs/zh_CN/api-reference/system/wdts.rst +++ b/docs/zh_CN/api-reference/system/wdts.rst @@ -74,8 +74,10 @@ IWDT 利用 {IDF_TARGET_IWDT_TIMER_GROUP} 中的 MWDT_WDT 看门狗定时器作 - IWDT 默认通过 :ref:`CONFIG_ESP_INT_WDT` 选项启用。 - 通过 :ref:`CONFIG_ESP_INT_WDT_TIMEOUT_MS` 选项设置 IWDT 超时。 - - 注意,如果启用了 PSRAM 支持,那么默认的超时时间会更长,因为在某些情况下,临界区或中断例程访问大量 PSRAM 需要更长时间。 - - IWDT 的配置超时时间应至少为 FreeRTOS tick 周期的两倍时长。例如,如果 FreeRTOS tick 周期间隔为 10 毫秒,则 IWDT 的超时时间应至少为 20 毫秒(参见 :ref:`CONFIG_FREERTOS_HZ`)。 + .. list:: + + :SOC_SPIRAM_SUPPORTED: - 注意,如果启用了 PSRAM 支持,那么默认的超时时间会更长,因为在某些情况下,临界区或中断例程访问大量 PSRAM 需要更长时间。 + - IWDT 的配置超时时间应至少为 FreeRTOS tick 周期的两倍时长。例如,如果 FreeRTOS tick 周期间隔为 10 毫秒,则 IWDT 的超时时间应至少为 20 毫秒(参见 :ref:`CONFIG_FREERTOS_HZ`)。 调优 ^^^^^^