From 71164460f3146f81e59efba8dfbab270fcb3a870 Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Sat, 24 Jun 2023 17:00:52 -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