Window Watchdog Timer (WDT) Setup

Information regarding WDT reset and other reset sources can be found in Reset Register Status.

The WDT on ATtiny3217 has two modes of operation; Normal mode and Window mode. FSFEB is using the Window mode operation. As shown in Figure 1, when using Window mode, the timeout period is split into two parts; the closed window and the open window. While in the closed window, attempting to clear the watchdog will result in a system reset. This is also reflected in the markings on FSFEB, as shown in Figure 2.

Figure 1. Window WDT
Figure 2. Window Watchdog Timer

The WDT Window mode operation is configured as shown below:

The RTC is configured to give a periodic interrupt each second. This is used to update a variable that counts the number of seconds since the last time the WDT was cleared. The RTC and WDT are running on the same clock, which means that the RTC periodic interrupt and the increase of the WDT counter will happen approximately at the same time.

The charlieplexed LEDs illustrating the closed and open window will light up, one LED per second. When the counter reaches 7 seconds, which is within the open window, the CPU will run the WDR instruction that clears the WDT counter. The application code will blink the WDT LED to indicate that the CPU has cleared the WDT and the counting will restart from zero. As long as the application keeps clearing the WDT reset flag inside the open window, the WDT will never reset the device.

A button is added to make it possible to manually clear the WDT. This means that the user can reset the device in the closed window on purpose in order to see the WDT reset the device. It is also possible to manually clear the WDT in the open window by using the button. This will not reset the device.

Note: When using the Cyclic Redundancy Check and an error is inserted in the Flash, the application code is written in such a way that it will stop clearing the WDT counter, and the WDT will get a timeout after 8.2 seconds and the device will be reset. After the reset, the error inserted in Flash will be written back to the original value by the application code. Refer to the Cyclic Redundancy Check section for more details.