Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2)#2904
Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2)#2904beala 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.
|
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 :) |
|
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 is a good quick solution. However, adding it to the main loop would be a better way to utilize the watchdog timer's full capabilities. |
|
I have received my MeshTower V2 and ran into this issue as well. I can confirm that this branch does fix the watchdog reset - uptime is 12+ hours and counting on my unit. |
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