From d14ca13dd8e4a23a042e3f0af70a21c015a8a0fb Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Sun, 6 Aug 2023 20:35:29 -0700 Subject: [PATCH] Disable watchdog timer when the firmware boots If it gets this far, the firmware is at least sort of running, so the watchdog has served its purpose of resetting to the bootloader if there's invalid firmware flashed to the device. --- hal/m258ke/board.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hal/m258ke/board.c b/hal/m258ke/board.c index 6c27f2a..809802c 100644 --- a/hal/m258ke/board.c +++ b/hal/m258ke/board.c @@ -68,6 +68,9 @@ void Board_Init(void) // Start the timer, prescaler = 48, so 1 MHz TIMER0->CTL = TIMER_CTL_CNTEN_Msk | (3UL << TIMER_CTL_OPMODE_Pos) | 47; + + // Disable WDT now; the main firmware is booted. + WDT->CTL = (6 << WDT_CTL_TOUTSEL_Pos); } /** Determines if a brownout was detected at startup