Skip to content

Commit 9c59bd0

Browse files
committed
Nuvoton: Fix watchdog reset failure on meeting Hard Fault
Original implementation doesn't enable watchdog reset in pieces of cascaded timeout, except the last one. This is to guarantee re-configuration can be in time, but in interrupt disabled scenario e.g. Hard Fault, watchdog reset can cease to be effective. This change enables watchdog reset all the way of cascaded timeout. With trade-off, guaranteed watchdog reset function is more significant than re-configuration in time.
1 parent f7861e6 commit 9c59bd0

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static void watchdog_setup_cascade_timeout(void)
188188
WDT_CTL_WKEN_Msk | // Enable wake-up on timeout
189189
WDT_CTL_IF_Msk | // Clear interrupt flag
190190
WDT_CTL_RSTF_Msk | // Clear reset flag
191-
(wdt_timeout_rmn_clk ? 0 : WDT_CTL_RSTEN_Msk) | // Enable reset on last cascaded timeout
191+
WDT_CTL_RSTEN_Msk | // Enable reset always to address cascaded timeout failure in interrupt disabled scenario e.g. Hard Fault
192192
WDT_CTL_RSTCNT_Msk; // Reset watchdog timer
193193

194194
SYS_LockReg();

targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static void watchdog_setup_cascade_timeout(void)
188188
WDT_CTL_WKEN_Msk | // Enable wake-up on timeout
189189
WDT_CTL_IF_Msk | // Clear interrupt flag
190190
WDT_CTL_RSTF_Msk | // Clear reset flag
191-
(wdt_timeout_rmn_clk ? 0 : WDT_CTL_RSTEN_Msk) | // Enable reset on last cascaded timeout
191+
WDT_CTL_RSTEN_Msk | // Enable reset always to address cascaded timeout failure in interrupt disabled scenario e.g. Hard Fault
192192
WDT_CTL_RSTCNT_Msk; // Reset watchdog timer
193193

194194
SYS_LockReg();

targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static void watchdog_setup_cascade_timeout(void)
193193
wdt_timeout_clk_toutsel | // Timeout interval
194194
WDT_CTL_WTE_Msk | // Enable watchdog timer
195195
WDT_CTL_WTWKE_Msk | // Enable wake-up on timeout
196-
(wdt_timeout_rmn_clk ? 0 : WDT_CTL_WTRE_Msk) | // Enable reset on last cascaded timeout
196+
WDT_CTL_WTRE_Msk | // Enable reset always to address cascaded timeout failure in interrupt disabled scenario e.g. Hard Fault
197197
WDT_CTL_WTR_Msk; // Reset watchdog timer
198198

199199
SYS_LockReg();

targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void watchdog_setup_cascade_timeout(void)
187187
WDT_CTL_WKEN_Msk | // Enable wake-up on timeout
188188
WDT_CTL_IF_Msk | // Clear interrupt flag
189189
WDT_CTL_RSTF_Msk | // Clear reset flag
190-
(wdt_timeout_rmn_clk ? 0 : WDT_CTL_RSTEN_Msk) | // Enable reset on last cascaded timeout
190+
WDT_CTL_RSTEN_Msk | // Enable reset always to address cascaded timeout failure in interrupt disabled scenario e.g. Hard Fault
191191
WDT_CTL_RSTCNT_Msk; // Reset watchdog timer
192192

193193
SYS_LockReg();

0 commit comments

Comments
 (0)