Skip to content

Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2)#2904

Open
beala wants to merge 1 commit into
meshcore-dev:devfrom
beala:beala/MeshTowerV2_feed_watchdog
Open

Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2)#2904
beala wants to merge 1 commit into
meshcore-dev:devfrom
beala:beala/MeshTowerV2_feed_watchdog

Conversation

@beala

@beala beala commented Jul 7, 2026

Copy link
Copy Markdown

Like clockwork, my MeshTower V2 restarts approximately every 9 minutes and 30 seconds. The variant.h for this device gives a clue as to why:

#define HAS_HARDWARE_WATCHDOG
#define HARDWARE_WATCHDOG_DONE (0 + 9)
#define HARDWARE_WATCHDOG_WAKE (0 + 10)
#define HARDWARE_WATCHDOG_TIMEOUT_MS (8 * 60 * 1000)

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.

DEBUG: PWRMGT: Reset = Reset Pin (0x1)

This feeds the doggo and toggles the DONE pin every 60 seconds inside of a SoftwareTimer to prevent the watchdog from resetting the device.

It would probably be better to feed the watchdog inside the main.cpp but 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:

# Checkout my PR
git fetch upstream pull/2904/head:pr-2904
git checkout pr-2904

# Build with a custom version string and serial debug logging turned on
PLATFORMIO_BUILD_FLAGS='-D FIRMWARE_VERSION=\"v1.16.0-watchdog-fix\" -D MESH_DEBUG=1' pio run -e Heltec_tower_v2_repeater

Head over to https://meshcore.io/flasher and use the "Custom firmware" option to flash .pio/build/Heltec_tower_v2_repeater/firmware.zip

If there are issues, you can run ver on the repeater CLI to verify v1.16.0-watchdog-fix is 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:

# Substitute in the correct /dev/... path.
screen /dev/serial/by-id/usb-Heltec_HT-n5262_5F3611E4949BEF11-if00 115200

cc @Quency-D who PR'd the original support for this device. #2752

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.
@beala beala changed the title Feed external hardware watchdog on Heltec Tower V2 Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2) Jul 7, 2026
@beala

beala commented Jul 7, 2026

Copy link
Copy Markdown
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 #defines are named slightly differently.

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 :)

@beala

beala commented Jul 7, 2026

Copy link
Copy Markdown
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.

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.

1 participant