Skip to content

Commit 7f25b2c

Browse files
authored
Merge pull request #14556 from OpenNuvoton/nuvoton_wdt_stop-n-kick_5.15
Nuvoton: Fix hal_watchdog_kick() with WDT stopped (5.15)
2 parents 0be7685 + e0aab8b commit 7f25b2c

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)
125125

126126
void hal_watchdog_kick(void)
127127
{
128+
if (!(WDT->CTL & WDT_CTL_WDTEN_Msk)) {
129+
return;
130+
}
131+
128132
wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
129133
watchdog_setup_cascade_timeout();
130134
}

targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)
124124

125125
void hal_watchdog_kick(void)
126126
{
127+
/* If a watchdog is not running, this function does nothing */
128+
if (!(WDT->CTL & WDT_CTL_WDTEN_Msk)) {
129+
return;
130+
}
131+
127132
wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
128133
watchdog_setup_cascade_timeout();
129134
}

targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)
123123

124124
void hal_watchdog_kick(void)
125125
{
126+
/* If a watchdog is not running, this function does nothing */
127+
if (!(WDT->CTL & WDT_CTL_WTE_Msk)) {
128+
return;
129+
}
130+
126131
wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
127132
watchdog_setup_cascade_timeout();
128133
}

targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)
124124

125125
void hal_watchdog_kick(void)
126126
{
127+
/* If a watchdog is not running, this function does nothing */
128+
if (!(WDT->CTL & WDT_CTL_WDTEN_Msk)) {
129+
return;
130+
}
131+
127132
wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
128133
watchdog_setup_cascade_timeout();
129134
}

0 commit comments

Comments
 (0)