You are on page 1of 11

NuMicro® WDT

A Leading MCU Platform Provider

June 2016
Agenda
• WDT
- Feature
- Block Diagram
- Timeout Interval Select
• WDT Example

2
Watchdog Timer Feature
• 18-bit up counter
• 8 selections of timeout interval
• 4 selections of WDT reset delay period
• Support function:
• WDT interrupt
• WDT reset
• WDT wake-up

3
WDT Block Diagram
• WDT can cause a WDT Interrupt or WDT Reset to CPU after a fixed delay period.

• WDT also can wakeup CPU form Power-down mode


WTR (WTCR[0])
Reset WDT Counter WTIF Watchdog
Internal 18-bit WDT Up Counter (WTCR[3]) Interrupt
WTIE
0 .. 4 …... 15 16 17
(WTCR[6])

000 Time-out
001 Reset Watchdog
: Interval [1]
: Delay Reset
110 Period WTRE
111 Select
Select (WTCR[1])
WDT_CLK WTRF
(WTCR[2])
WTE WTIS WTRDSEL
(WTCR[7]) (WTCR[10:8]) (WTCRALT[1:0])
Wake-up system from
Idle/Power-down mode
WTWKE
Note1: WDT resets CPU and lasts 63 WDT_CLK. (WTCR[4])
WTWKF
Note2: If user intends to use WDT to wake-up Idle/Power-down mode, (WTCR[5])
it is recommended that CPU clock source is set as the same as
WDT clock source before CPU enters in Power-down mode. 4
WDT Clock Source

WDT_S (CLKSEL1[1:0])

WDT_EN (APBCLK[0])

10 kHz LIRC
11
WDT_CLK
HCLK/2048
10

32.768 kHz LXT


01
Legend:
LXT = Low-Speed External clock signal
LIRC = Low-Speed Internal clock signal

Note: Before clock switching, both the pre-selected and newly selected clock sources
must be turned on and stable.
5
WDT Timeout Interval Select
*1 WDT Timeout *2 WDT Timeout Interval WDT Reset Interval
WTIS WDT Reset Interval
Interval (WDT_CLK = 10kHz) (WDT_CLK = 10kHz)

0 24 × TWDT_CLK (24 + Delay Clock) × TWDT_CLK 1.6 ms 1.9 ms ~ 104.2 ms


1 26 × TWDT_CLK (26 + Delay Clock) × TWDT_CLK 6.4 ms 6.7 ms ~ 109.0 ms
2 28 × TWDT_CLK (28 + Delay Clock) × TWDT_CLK 25.6 ms 25.9 ms ~ 128.2 ms
(210 + Delay Clock) ×
3 210 × TWDT_CLK 102.4 ms 102.7 ms ~ 205.0 ms
TWDT_CLK
(212 + Delay Clock) ×
4 212 × TWDT_CLK 409.6 ms 409.9 ms ~ 512.2 ms
TWDT_CLK
(214 + Delay Clock) ×
5 214 × TWDT_CLK 1.6384 s 1.6387 s ~ 1.7410 s
TWDT_CLK
(216 + Delay Clock) ×
6 216 × TWDT_CLK 6.5536 s 6.5539 s ~ 6.6562 s
TWDT_CLK
(218 + Delay Clock) ×
7 218 × TWDT_CLK 26.2144 s 26.2147 s ~ 26.3170 s
TWDT_CLK

*1 WTIS(WTCR[10:8]) is timeout interval for the watchdog timer.


*2 “Delay Clock” selection has 3, 18, 130 and 1026, select by WTRDSEL(WTCRALT[1:0])
6
WDT Timeout Interval & Reset Timing
WTRF = 1
WTIF = 1 (if WTRE = 1)
TWDT

WDT_CLK

TTIS TRSTD

WDT reset TRST


(low reset)

· TWDT : Watchdog Clock Time Period

· TTIS : Watchdog Timeout Interval Period ( (24 ~ 218) * TWDT )

· TRSTD : Watchdog Reset Delay Period ( (3/18/130/1026) * TWDT )

· TRST : Watchdog Reset Period ( 63 * TWDT )

7
Sample Code Path

NUC029xEEBSPv3.00.001

NuMicro NUC029 Series


SampleCode Driver Reference Guide

StdDriver

WDT_TimeoutINT

WDT_TimeoutINT.uvproj
KEIL

8
Functions and Sample Code in BSP
• \SampleCode\StdDriver
- WDT_PowerDown
- WDT_TimeoutINT
- WDT_TimeoutReset
- WWDT_CompareINT

9
WDT Sample Code
int main (void)
{
/* Select WDT time-out interval to 2^14 * WDT clock then start WDT counting */
//Initial WDT (timeout interval 1.638 s)
WDT_Open(WDT_TIMEOUT_2POW14,WDT_RESET_DELAY_3CLK,FALSE,FALSE);
/* Enable WDT interrupt function */
WDT_EnableInt();
/* Enable WDT NVIC */
NVIC_EnableIRQ(WDT_IRQn);
while(1)
{ /* Check if WDT time-out interrupt occurred or not */
while(g_u8IsWDTTimeoutINT == 0);
g_u8IsWDTTimeoutINT = 0;
PA0 ^= 1;
printf("WDT time-out interrupt occurred. INT counts: %d \r", ++u32IntCnts);
}
}
10
Thank you!

You might also like