Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PicoW Infinite Reboot due to WiFi Failure #514

Merged
merged 10 commits into from
Dec 6, 2023

Conversation

brentru
Copy link
Member

@brentru brentru commented Dec 5, 2023

This pull request aims to fix the PicoW infinite reboot bug due to WiFi failure. This issue seems to mostly be occurring on routers that are mesh networks or far away from a Rasberry Pi Pico W.

The result is in an inoperable WipperSnapper device as the WiFi never connects and the WDT is kicked, forcing the device to reboot forever:

Adafruit.io WipperSnapper
-------Device Information-------
....
Board ID: rpi-pico-w
....
-------------------------------
Generating device's MQTT topics...
Running Network FSM...
Connecting to WiFi...
Attempting to connect to WiFi...
Attempting to connect to WiFi...
Attempting to connect to WiFi...
Attempting to connect to WiFi...
Attempting to connect to WiFi...
ERROR: Unable to connect to WiFi!
ERROR [WDT RESET]: ERROR: Unable to connect to WiFi, rebooting soon...

This pull request:

  • Increases WiFi connection reliability
    • In ws_networking_pico.h, this PR now sets a 20-second timeout for connecting to an AP, rather than the default, and waits a full 20 seconds to establish a connection.
    • Discovered that the max WDT for the PicoW is ~8sec and reloaded with the amount of time it was initialized with (6sec, globally). The wdt is now reloaded before longer (blocking/async) function calls within runNetFSM() to avoid accidentally timing out the WDT.

Resolves:
#436
#435
#432

@brentru brentru requested a review from tyeth December 5, 2023 22:45
@brentru brentru marked this pull request as ready for review December 6, 2023 00:37
@brentru
Copy link
Member Author

brentru commented Dec 6, 2023

@tyeth ready for review

@earlephilhower
Copy link

FYI:

WIP: Updates our build CI to use the latest version of arduino-pico to grab PR earlephilhower/arduino-pico#1883 and we may want to wait for earlephilhower/arduino-pico#1884 as well before merging

Those PRs only affect FreeRTOS sketches, and this project doesn't seem to use FreeRTOS so they shouldn't affect things here. If there are WiFi issues on bare metal, don't hesitate to open up something on the Arduino-Pico repo, of course!

You'll also need to undo the change to the doxygen yml in this PR since it points to your repo, not Adafruit's now.

@brentru
Copy link
Member Author

brentru commented Dec 6, 2023

Those PRs only affect FreeRTOS sketches, and this project doesn't seem to use FreeRTOS so they shouldn't affect things here.

Interestingly, I noticed the WiFi connection stability increase when building from arduino-pico master vs Release. But since things have changed and you've clarified this only affects FreeRTOS sketches, I'll try building this PR off the Release.

@brentru
Copy link
Member Author

brentru commented Dec 6, 2023

No difference between building off arduino-pico release, this PR fixes the timing/timeouts. Thanks for the clarification @earlephilhower.

@brentru brentru merged commit dfc403c into adafruit:main Dec 6, 2023
31 checks passed
@brentru brentru deleted the fix-wifi-picow branch December 6, 2023 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants