2.1.3.3 DIAG_WDT_Startup()

void DIAG_WDT_Startup (void )

Tests the WDT, protects against runaway code, deadlocks and the program counter not working.

This API checks the WDT resets when the timer is being cleared either too early or too late. This test will not be called from main. It will be executed before main is entered, as long as the diag_wdt_startup.h/.c and powerup_xx.as files are included in the compilation. This is the simple timer-based WDT self-diagnostic test. It tests that the WDT resets the device when the WDT counter is not cleared. The next step tests that the WDT counter will be cleared without resetting the device. Once this is confirmed, the device is again reset by the WDT. This function tests the following:

  1. WDT issues a system Reset after time-out.

  2. WDT timing and that it can be cleared.

The expected (error-free) execution flow:
  1. Power-on Reset (POR) or External Reset has occurred.

  2. Check that WDT can issue a system Reset. Set test state to Simple Timer and system Reset.

  3. Check that WDT can be cleared.

  4. Set test state to ok and continue to main(). TMR0 functions as an independent clock source to the WDT clock and checks the timing of the oscillator used by the WDT. If the device and WDT were reset correctly in each step of the test, then the diag_wdt_teststate is set to DIAG_WDT_FSM_OK and diag_wdt_status is set to DIAG_PASS, otherwise the diag_wdt_teststate is set to DIAG_WDT_FAULT and diag_wdt_status is set to DIAG_FAIL thereby indicating Fault.

Error reporting: Call DIAG_WDT_GetResult() from main to see the status of the WDT diagnosis.
Parameters:
None.