mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1603] ESP32 Watchdog timeout triggered repeatedly #1367
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1367
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @chriskinal on GitHub (May 11, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1603
Basic Infos
Hardware
WiFimanager Branch/Release: 2.0.15-rc.1
Esp32:
Hardware: ESP32-WROOM-DA Module
Core Version:
Description
Problem description
Upload "Basic" example to an ESP32.
Start the system and connect a serial terminal.
Connect Windows laptop to "AutoconnectAP"
Redirected to WiFi Manager portal.
Click on an AP from the list of scanned AP's.
Type the pasword
A watchdog time out is triggered and reboots the system.
Settings in IDE
Module: ESP32-WROOM-DA Module
Additional libraries:
Sketch
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
void setup() {
// WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
// it is a good practice to make sure your code sets wifi mode how you want it.
}
void loop() {
// put your main code here, to run repeatedly:
}
Debug Messages
06:13:12.936 -> ets Jul 29 2019 12:21:46
06:13:12.936 ->
06:13:12.936 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
06:13:12.936 -> configsip: 0, SPIWP:0xee
06:13:12.936 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
06:13:12.936 -> mode:DIO, clock div:1
06:13:12.936 -> load:0x3fff0030,len:1344
06:13:12.936 -> load:0x40078000,len:13924
06:13:12.936 -> ho 0 tail 12 room 4
06:13:12.936 -> load:0x40080400,len:3600
06:13:12.969 -> entry 0x400805f0
06:13:13.266 -> *wm:AutoConnect
06:13:13.366 -> *wm:No wifi saved, skipping
06:13:13.366 -> *wm:AutoConnect: FAILED
06:13:13.366 -> *wm:StartAP with SSID: AutoConnectAP
06:13:13.856 -> *wm:AP IP address: 192.168.4.1
06:13:13.856 -> *wm:Starting Web Portal
06:13:59.939 -> *wm:9 networks found
06:14:04.946 -> E (51925) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
06:14:04.946 -> E (51925) task_wdt: - IDLE (CPU 0)
06:14:04.946 -> E (51925) task_wdt: Tasks currently running:
06:14:04.946 -> E (51925) task_wdt: CPU 0: loopTask
06:14:04.946 -> E (51925) task_wdt: CPU 1: IDLE
06:14:04.946 -> E (51925) task_wdt: Aborting.
06:14:04.946 ->
06:14:04.980 -> abort() was called at PC 0x400ec529 on core 0
06:14:04.980 ->
06:14:04.980 ->
06:14:04.980 -> Backtrace: 0x40083641:0x3ffbec7c |<-CORRUPTED
06:14:04.980 ->
06:14:04.980 ->
06:14:04.980 ->
06:14:04.980 ->
06:14:04.980 -> ELF file SHA256: 576a586d4c46321f
06:14:04.980 ->
06:14:05.143 -> Rebooting...
06:14:05.143 -> ets Jul 29 2019 12:21:46
06:14:05.143 ->
06:14:05.143 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
06:14:05.143 -> configsip: 0, SPIWP:0xee
06:14:05.143 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
06:14:05.177 -> mode:DIO, clock div:1
06:14:05.177 -> load:0x3fff0030,len:1344
06:14:05.177 -> load:0x40078000,len:13924
06:14:05.177 -> ho 0 tail 12 room 4
06:14:05.177 -> load:0x40080400,len:3600
06:14:05.177 -> entry 0x400805f0
06:14:05.472 -> *wm:AutoConnect
06:14:05.570 -> *wm:No wifi saved, skipping
06:14:05.570 -> *wm:AutoConnect: FAILED
06:14:05.604 -> *wm:StartAP with SSID: AutoConnectAP
06:14:06.095 -> *wm:AP IP address: 192.168.4.1
06:14:06.095 -> *wm:Starting Web Portal
@chriskinal commented on GitHub (May 11, 2023):
I switched the Arduino IDE from ESP32-WROOM-DA module to ESP32 Dev Module and added some lines to reset the watchdog within every 'while' loop.
Additional library:
#include "esp_task_wdt.h"
Example usage:
while(retry <= _connectRetries && (connRes!=WL_CONNECTED)){
esp_task_wdt_reset();
.....rest of code
Just switching the board or just adding watchdog reset did not resolve the issue. I had to do both.
@tablatronix commented on GitHub (May 11, 2023):
interesting, did you try to just add a delay(0) or yield() in the connectWifi while loop? It seems there is not one and some of the new connection workarounds might have introduced this..
@chriskinal commented on GitHub (May 12, 2023):
I tried delay() which did not help. I think because it creates some sort of tight loop that only makes the problem worse.
I tried yield() and it seems to be working. I put one in all 5 "while loops" in the code. I found that not having them in all "while loops" caused the issue when execution hit that part of the function.
PS. The Arduino IDE 2 is annoying in that there is no good way to do a "clean". Even closing and reopening it. It seems making these small changes in the library did not force the IDE to recompile the library. Had to change the board to some other board than the one I am using, compile, change the board back to the one I am using. Then compile and upload to get the changes into the build correctly. This is a known issue and the IDE devs copped an attitude with someone who presented the issue and closed the issue with "no issue". Their reasoning was why make a feature only 0.1% of the users will use. PlatformIO within VSCode has tasks for "clean" and "clean all" that make it much easier.
@tablatronix commented on GitHub (May 12, 2023):
That is the only loop without a delay or yield, Yeah arduino IDE will only let you modify libs if they are external I think, you have to link them
@chriskinal commented on GitHub (May 12, 2023):
I found 5. Lines 295, 786, 1041, 1250 & 1540. 295 has a delay() but that did not seem to work.
@tablatronix commented on GitHub (May 12, 2023):
Are you doing anything special, using some core pinning code or deep sleep or what?
Is there some caveats to the ESP32-WROOM-DA module, its just a regular esp32 right?
Something sounds wrong with your env.
What cpu and flash speeds, etc
@tablatronix commented on GitHub (May 12, 2023):
06:14:04.980 -> Backtrace: 0x40083641:0x3ffbec7c |<-CORRUPTEDI would love to see a decoded backtrace for this, I wonder where its failing
Also try using wm.setConnectTimeout to override the esp connectiontimer
@chriskinal commented on GitHub (May 12, 2023):
CPU = ESP32-WROOM-32
Freq = 240MHz
Erase flash before upload.
Flash freq = 80MHz
Flash mode = QIO
Upload speed = 921600
I am using a generic ESP32 board that has the above CPU on it. I have used the ESP32-WROOM-DA board profile in the Arduino IDE with this board on a number of projects and never had an issue. I can reliably reproduce the issue with the "Basic" example in the WiFiManager package. The only difference I noticed is when using the ESP32-WROOM-DA board profile is used the blue wifi led on the board flashes with wifi activity. Using the ESP32 Dev Module profile the blue wifi led is off. The blue led is on GPIO 2.
@tablatronix commented on GitHub (May 12, 2023):
Have you tried 2.0.16 yet?
@chriskinal commented on GitHub (May 12, 2023):
I am using 2.1.0 (latest) as I am on a Mac.
@tablatronix commented on GitHub (May 12, 2023):
? I mean WM ?
@chriskinal commented on GitHub (May 12, 2023):
Ooops. I thought you meant Arduino IDE version. wm is at 2.0.16-rc.2.
@chriskinal commented on GitHub (May 19, 2023):
So I tested this with multiple ESP32 board profiles in Arduino IDE. It seems any profile I tried that makes use of the blue LED (GPIO2) triggers the watchdog issue. Board profiles that do not make use of the blue LED function as expected. I have a solution for my project by using a board profile that does not use the blue LED. The board is inside an enclosure so I can't see the blue light even if it was working. ;-)
Up to the devs on how they want to close out this issue.
@tablatronix commented on GitHub (May 19, 2023):
curious, Do you have setDebugOutput(true); in your code?
check you entire codebase for serial.flush()
What is a board profile that produces this?
@chriskinal commented on GitHub (May 19, 2023):
I am using the Basic example from the WM repo with no modifications. setDebugOutput() is not set in the example.
Not really any codebase to check other than WM.
@tablatronix commented on GitHub (May 19, 2023):
Ok let me try to test one of those board defs
@chriskinal commented on GitHub (May 19, 2023):
Here are the board manger URL's I use.
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
https://www.pjrc.com/teensy/package_teensy_index.json
@tablatronix commented on GitHub (May 31, 2023):
Anything else on this? I do not have a DA module, I will try using DA def on a regular ESP32 but i doubt it will reproduce, also i do not know which esp lib ver
@chriskinal commented on GitHub (May 31, 2023):
I feel like it is something upstream in the board definition files. Changing to a board definition file for a board that does not have the blue LED works fine. Adding Yield() to the loops in WM works fine. I can do digitalWrite(..) to the GPIO to manipulate the blue LED fine.
Thanks for all your help. Please feel free to close this one one out since I have multiple work-arounds and it feels like an upstream problem.
@tablatronix commented on GitHub (May 31, 2023):
Sounds like a bad pin def file, or conflict with the serial uart.
I will reopen if it comes up again or i can repro
@tablatronix commented on GitHub (Jun 1, 2023):
What dev board are you using?
@chriskinal commented on GitHub (Jun 1, 2023):
A no-name board from Amazon. The chip says ESP32-WROOM-32. The underside says ESP32S. It is of the 30 pin variety.
@tablatronix commented on GitHub (Jun 1, 2023):
Then why are you using a DA board def?
@chriskinal commented on GitHub (Jun 1, 2023):
It was one of two in Arduino IDE that were related to the WROOM. the uPesy ESP32 WROOM DevKit profile did the same thing.
@dagi0627 commented on GitHub (Dec 20, 2023):
I am using esp-idf extension on vscode and Arduino ESP32 as ESP-IDF components
@UradaSources commented on GitHub (Jul 9, 2024):
this problem can be solved by using a non-blocking version
for the main function of idf style: