Watchdog Trigger at app_main() – WiFi PHY Wake-Up and Flash Read Deadlock (Log Comparison)

shyamanthulaanil
Posts: 5
Joined: Thu Jun 06, 2024 9:12 am

Watchdog Trigger at app_main() – WiFi PHY Wake-Up and Flash Read Deadlock (Log Comparison)

Postby shyamanthulaanil » Tue Jul 29, 2025 6:26 am

**Device Log Comparison: Working vs. Failed Logs**

We are debugging a device issue where the ESP32 application stalls during initialization.
I compared the **working log** vs. **failed log** (see attached file for side-by-side comparison).



### Root Cause Observations:
In the failed device log:
- Both CPUs boot normally, and app_main() starts.
- The watchdog triggers because:
- The IDLE task on CPU1 (App CPU) does not reset the watchdog.
- CPU1 appears stalled during WiFi PHY wake-up and flash read, leading to a deadlock.



### Request for Help:
- Has anyone faced similar watchdog stalls during WiFi initialization?
- Are there known fixes or workarounds (timing adjustments, flash configuration, or watchdog tuning)?


ESP-IDF version: [esp-idf-v5.1.2]
Board: [Custome board with ESP32-S3]
Attachments
Failure Root Cause Analysis.docx
(195.39 KiB) Downloaded 133 times

nopnop2002
Posts: 362
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Watchdog Trigger at app_main() – WiFi PHY Wake-Up and Flash Read Deadlock (Log Comparison)

Postby nopnop2002 » Sat Aug 02, 2025 10:46 am

Once you connect to Wi-Fi, connection information and PHY calibration information will be stored in NVS.

Code: Select all

esp32> nvs_list nvs
namespace 'nvs.net80211', key 'ap.sndchan', type 'u8'
namespace 'nvs.net80211', key 'sta.ssid', type 'blob'
namespace 'nvs.net80211', key 'sta.pswd', type 'blob'
namespace 'nvs.net80211', key 'bssid.set', type 'u8'
namespace 'nvs.net80211', key 'sta.lis_intval', type 'u16'
namespace 'nvs.net80211', key 'sta.scan_method', type 'u8'
namespace 'nvs.net80211', key 'sta.sort_method', type 'u8'
namespace 'nvs.net80211', key 'sta.minrssi', type 'i8'
namespace 'nvs.net80211', key 'sta.minauth', type 'u8'
namespace 'nvs.net80211', key 'sta.apsw', type 'blob'
namespace 'nvs.net80211', key 'sta.pmf_e', type 'u8'
namespace 'nvs.net80211', key 'sta.pmf_r', type 'u8'
namespace 'nvs.net80211', key 'sta.rrm_e', type 'u8'
namespace 'nvs.net80211', key 'sta.btm_e', type 'u8'
namespace 'nvs.net80211', key 'sta.mbo_e', type 'u8'
namespace 'nvs.net80211', key 'sta.ft', type 'u8'
namespace 'nvs.net80211', key 'sta.owe', type 'u8'
namespace 'nvs.net80211', key 'sta.bss_retry', type 'u8'
namespace 'nvs.net80211', key 'sta.trans_d', type 'u8'
namespace 'nvs.net80211', key 'sta.sae_h2e', type 'u8'
namespace 'nvs.net80211', key 'sta.sae_pk_mode', type 'u8'
namespace 'nvs.net80211', key 'sta.sae_h2e_id', type 'blob'
namespace 'phy', key 'cal_data', type 'blob'
namespace 'phy', key 'cal_mac', type 'blob'
namespace 'phy', key 'cal_version', type 'u32'
namespace 'nvs.net80211', key 'sta.pwr_reset', type 'u8'
namespace 'nvs.net80211', key 'sta.chan', type 'u8'
namespace 'nvs.net80211', key 'sta.apinfo', type 'blob'
The NVS may not be read correctly for some reason.

Try clearing the NVS.

shyamanthulaanil
Posts: 5
Joined: Thu Jun 06, 2024 9:12 am

Re: Watchdog Trigger at app_main() – WiFi PHY Wake-Up and Flash Read Deadlock (Log Comparison)

Postby shyamanthulaanil » Mon Aug 04, 2025 5:56 am

Hi,
Thank you for your response.

We’ve observed that the watchdog is triggering during app_main(), and logs suggest that NVS may not be read correctly. However, performing a full NVS erase is not an option for us, as we store important credential data in NVS that must be retained.

Could you please advise if there are any alternative solutions or recommended best practices for recovering from potential NVS issues without performing a full erase?

nopnop2002
Posts: 362
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Watchdog Trigger at app_main() – WiFi PHY Wake-Up and Flash Read Deadlock (Log Comparison)

Postby nopnop2002 » Mon Aug 04, 2025 9:50 am

You can use this sample to see what values are stored in nvs.
https://github.com/espressif/esp-idf/tr ... e/advanced
You may be able to identify the key that cannot be read.

Code: Select all


esp32> nvs_list nvs
namespace 'nvs.net80211', key 'ap.sndchan', type 'u8'
namespace 'nvs.net80211', key 'sta.ssid', type 'blob'
namespace 'nvs.net80211', key 'sta.pswd', type 'blob'
namespace 'nvs.net80211', key 'bssid.set', type 'u8'
namespace 'nvs.net80211', key 'sta.lis_intval', type 'u16'
namespace 'nvs.net80211', key 'sta.scan_method', type 'u8'
namespace 'nvs.net80211', key 'sta.sort_method', type 'u8'
namespace 'nvs.net80211', key 'sta.minrssi', type 'i8'
namespace 'nvs.net80211', key 'sta.minauth', type 'u8'
namespace 'nvs.net80211', key 'sta.apsw', type 'blob'
namespace 'nvs.net80211', key 'sta.pmf_e', type 'u8'
namespace 'nvs.net80211', key 'sta.pmf_r', type 'u8'
namespace 'nvs.net80211', key 'sta.rrm_e', type 'u8'
namespace 'nvs.net80211', key 'sta.btm_e', type 'u8'
namespace 'nvs.net80211', key 'sta.mbo_e', type 'u8'
namespace 'nvs.net80211', key 'sta.ft', type 'u8'
namespace 'nvs.net80211', key 'sta.owe', type 'u8'
namespace 'nvs.net80211', key 'sta.bss_retry', type 'u8'
namespace 'nvs.net80211', key 'sta.trans_d', type 'u8'
namespace 'nvs.net80211', key 'sta.sae_h2e', type 'u8'
namespace 'nvs.net80211', key 'sta.sae_pk_mode', type 'u8'
namespace 'nvs.net80211', key 'sta.sae_h2e_id', type 'blob'
namespace 'phy', key 'cal_data', type 'blob'
namespace 'phy', key 'cal_mac', type 'blob'
namespace 'phy', key 'cal_version', type 'u32'
namespace 'nvs.net80211', key 'sta.pwr_reset', type 'u8'
namespace 'nvs.net80211', key 'sta.chan', type 'u8'
namespace 'nvs.net80211', key 'sta.apinfo', type 'blob'

esp32> nvs_namespace nvs.net80211
I (68560) cmd_nvs: Namespace set to 'nvs.net80211'
esp32> nvs_get ap.sndchan u8
1
esp32> nvs_get sta.ssid blob
0e000000617465726d2d6435613465652d67000000000000000000000000000000000000

esp32> nvs_namespace phy
I (162770) cmd_nvs: Namespace set to 'phy'
esp32> nvs_get cal_version u32
4860

Who is online

Users browsing this forum: ChatGPT-User, Google [Bot] and 4 guests