From dbd34ed63e5cead68afc6691175341d317bb1e9b Mon Sep 17 00:00:00 2001 From: Chun-Chieh Li Date: Mon, 9 Mar 2020 16:46:13 +0800 Subject: [PATCH] NANO130: Enlarge timeout in CLK_WaitClockReady(...) Most code doesn't check return code of CLK_WaitClockReady(...). Enlarge timeout to meet most cases. lp_ticker initialization fails with this issue. Steps for reproducing: 1. System runs in tickless from lp_ticker mode. 2. Arm WDT reset. 3. In next reset cycle, lp_ticker initialization fails (active flag doesn't become active). --- .../TARGET_NANO100/device/StdDriver/nano100_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver/nano100_clk.c b/targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver/nano100_clk.c index 16bcab302d..3f763078b0 100644 --- a/targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver/nano100_clk.c +++ b/targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver/nano100_clk.c @@ -613,7 +613,7 @@ uint32_t CLK_WaitClockReady(uint32_t u32ClkMask) { int32_t i32TimeOutCnt; - i32TimeOutCnt = __HSI / 200; /* About 5ms */ + i32TimeOutCnt = __HSI / 20; /* About 50ms */ while((CLK->CLKSTATUS & u32ClkMask) != u32ClkMask) { if(i32TimeOutCnt-- <= 0)