Professional Documents
Culture Documents
08 Nutiny-Nuc029 WDT
08 Nutiny-Nuc029 WDT
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.
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
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)
WDT_CLK
TTIS TRSTD
7
Sample Code Path
NUC029xEEBSPv3.00.001
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!