From d823756cb731f9f02a70c53b806627580d46c66c Mon Sep 17 00:00:00 2001 From: Chun-Chieh Li Date: Mon, 4 May 2020 16:14:02 +0800 Subject: [PATCH] Nuvoton: Enlarge WDT reset delay to avoid premature WDT reset Consider the following factors to define WDT reset delay: 1. Cannot be too small. This is to avoid premature WDT reset in pieces of timeout cascading. 2. Cannot be too large. This is to pass Greentea reset_reason/watchdog_reset tests, which have e.g. 50~100 reset delay tolerance. --- targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c | 8 ++++++-- targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c | 8 ++++++-- targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c | 8 ++++++-- targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c b/targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c index cf54a405d2..308a577812 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c @@ -43,8 +43,12 @@ #define NU_WDT_65536CLK 65536 #define NU_WDT_262144CLK 262144 -/* Watchdog reset delay */ -#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_3CLK +/* Watchdog reset delay + * + * 1. Cannot be too small. This is to avoid premature WDT reset in pieces of timeout cascading. + * 2. Cannot be too large. This is to pass Greentea reset_reason/watchdog_reset tests, which have e.g. 50~100 reset delay tolerance. + */ +#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_130CLK /* Support watchdog timeout values beyond H/W * diff --git a/targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c b/targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c index dfc52bba97..ce729b8147 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c @@ -44,8 +44,12 @@ #define NU_WDT_65536CLK 65536 #define NU_WDT_262144CLK 262144 -/* Watchdog reset delay */ -#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_3CLK +/* Watchdog reset delay + * + * 1. Cannot be too small. This is to avoid premature WDT reset in pieces of timeout cascading. + * 2. Cannot be too large. This is to pass Greentea reset_reason/watchdog_reset tests, which have e.g. 50~100 reset delay tolerance. + */ +#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_130CLK /* Support watchdog timeout values beyond H/W * diff --git a/targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c b/targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c index 288e9367fb..907657888a 100644 --- a/targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c @@ -42,8 +42,12 @@ #define NU_WDT_65536CLK 65536 #define NU_WDT_262144CLK 262144 -/* Watchdog reset delay */ -#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_3CLK +/* Watchdog reset delay + * + * 1. Cannot be too small. This is to avoid premature WDT reset in pieces of timeout cascading. + * 2. Cannot be too large. This is to pass Greentea reset_reason/watchdog_reset tests, which have e.g. 50~100 reset delay tolerance. + */ +#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_130CLK /* Support watchdog timeout values beyond H/W * diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c b/targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c index 01fb436b2e..aa4f4e130b 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c @@ -42,8 +42,12 @@ #define NU_WDT_65536CLK 65536 #define NU_WDT_262144CLK 262144 -/* Watchdog reset delay */ -#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_3CLK +/* Watchdog reset delay + * + * 1. Cannot be too small. This is to avoid premature WDT reset in pieces of timeout cascading. + * 2. Cannot be too large. This is to pass Greentea reset_reason/watchdog_reset tests, which have e.g. 50~100 reset delay tolerance. + */ +#define NU_WDT_RESET_DELAY_RSTDSEL WDT_RESET_DELAY_130CLK /* Support watchdog timeout values beyond H/W *