Intel cpb4612 User Manual

Page of 104
 
 37
7.4  Using the Watchdog in an Application 
The following topics are provided to aid you in learning to use watchdog in an application.  
7.4.1  WDT Unlocking and Programming Sequence 
Unlocking and programming the WDT Memory Mapped registers involves the following sequence: 
1.  Write “80” to the Reload Register (offset BAR + 0Ch) 
2.  Write “86” to the Reload Register (offset BAR + 0Ch) 
3.  Write to desired memory mapped register (offset BAR + 0Xh) 
7.4.2 Watchdog 
Reset 
An application using the reset feature sets the preload values, enables the watchdog reset, and then 
periodically reloads the watchdog to keep it from resetting the system.  If a reload is missed, the 
watchdog times out and resets the system hardware. 
7.4.2.1 
Load Preload Values 
The following is an algorithm for loading the preload values : 
1.  If the value desired falls between 1ms and 10min, clear bit 2 WDT_PRE_SEL of the WDT 
Configuration Register. Else if the value desired falls between 1µs and 1sec set bit 2 of 
the WDT Configuration Register. 
2.  Write “80” to the memory mapped Reload Register (offset BAR + 0Ch) 
3.  Write “86” to the memory mapped Reload Register (offset BAR + 0Ch) 
4.  Write desired value to the memory mapped Preload Value 1 register (offset BAR + 00h) 
5.  Write “80” to the memory mapped Reload Register (offset BAR + 0Ch) 
6.  Write “86” to the memory mapped Reload Register (offset BAR + 0Ch) 
7.  Write desired value to the memory mapped Preload Value 2 register (offset BAR + 04h) 
7.4.2.2 
Enabling the Watchdog Reset 
To enable the watchdog do the following 
1.  Set bit 1 of the WDT Lock Register to ‘1’ to enable the watchdog timer. 
7.4.2.3 
Reloading the Watchdog 
Once the watchdog is enabled, it must be periodically reloaded within the terminal count period to avoid 
resetting the system hardware. This should be done by the following: 
1.  Write “80” to the memory mapped Reload Register (offset BAR + 0Ch) 
2.  Write “86” to the memory mapped Reload Register (offset BAR + 0Ch) 
3.  Write ‘1’ to bit 8 WDT_RELOAD in the Reload Register (offset BAR + 0Ch)