6.1 How the Self-Diagnostic Routine Can Be Tested

The first step of the self-diagnostic routine will set the error state unless there is a system reset. A problem in the WDT that prevents it from being able to issue system resets could be replicated simply by not starting the WDT. The error state would be set and the device would hang.

Frequency failure of the oscillator for the WDT or the Timer/Counter could be simulated by setting a breakpoint and modifying the value of the tc_count variable so that it is outside the interval of confidence.

Failure in the WDT reset mechanism could be simulated by removing the line of code where the WDT is reset. Given the structure of the program, the second step in the self-diagnostic routine will set the error state unless the WDT follows the time constraints that are imposed.

Failure in the WDT window mode could be simulated by removing the setup of that mode. The code would then reset the WDT and wait for ¼ of the WDT period. At that point, the WDT period would be greater or equal to the estimated WDT period (the total timeout period is the sum of the open and closed periods). The device will not be reset before setting the error state.

The configured actions for a system reset issued by the WDT can be tested through the demo application. Pressing the button will lead to the WDT expiring. Then the self-diagnostic routine would execute the configured actions, which in this case is to set up the WDT, and set the variable classb_error, and turn the LED OFF.