Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2)#2904
Open
beala wants to merge 1 commit into
Open
Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2)#2904beala wants to merge 1 commit into
beala wants to merge 1 commit into
Conversation
The board has an external watchdog IC wired to HARDWARE_WATCHDOG_DONE/ WAKE, but nothing ever pulsed DONE to reset it, causing the board to hard-reset via the RESET pin roughly every 8-10 minutes. Start a periodic timer in begin() that toggles DONE well within the timeout.
Author
|
It looks like there's an unmerged PR for V1 of this device (#1446) to solve this same issue. Time is a flat circle. Unfortunately, it doesn't look like merging V1's PR will fix V2 because the So merging this PR is still useful, but I defer to Heltec on how they want to fix this. I just want my device to work :) |
Author
|
Thanks for taking a look @Quency-D! Can I interpret the thumbs up reactji as a stamp of approval from Heltec? If not, I'm happy to hand over the reigns. Just open another PR and I'll close this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Like clockwork, my MeshTower V2 restarts approximately every 9 minutes and 30 seconds. The
variant.hfor this device gives a clue as to why:MeshCore/variants/heltec_tower_v2/variant.h
Lines 85 to 88 in fec88e1
Both pins and a timeout for a watchdog are defined, but never used. After one of these reboots, I can see this over the serial port, which is consistent with an external watchdog device resetting the MCU.
This feeds the doggo and toggles the DONE pin every 60 seconds inside of a
SoftwareTimerto prevent the watchdog from resetting the device.It would probably be better to feed the watchdog inside the
main.cppbut there's no existing hook for this as far as I can tell. Simply spinning up a timer for this specific board and making no big architecture changes seemed like the easier and less controversial change. Let me know if you have thoughts.Testing
I flashed this to my device and verified the device hasn't rebooted with an uptime of 13 minutes, an uptime never before reached on this device.
If you'd like to test this yourself, here are build instructions for a repeater:
Head over to https://meshcore.io/flasher and use the "Custom firmware" option to flash
.pio/build/Heltec_tower_v2_repeater/firmware.zipIf there are issues, you can run
veron the repeater CLI to verifyv1.16.0-watchdog-fixis the version string. That verifies that you flashed your build.You can connect to the repeater over serial and look for something like
DEBUG: PWRMGT: Fed hardware watchdog (t=541020 ms)to verify that the fix is actually running. How to connect is platform specific. On Linux, you can use screen:cc @Quency-D who PR'd the original support for this device. #2752