2.1.3.3 DIAG_WWDT_Startup()
void DIAG_WWDT_Startup (void )
Checks that the Windowed Watchdog Timer (WWDT) is able to issue a timely system reset, that a WWDT counter reset in the open window does not cause a system reset and that a WWDT counter reset in the closed window causes a system reset. This diagnostic is intended to be executed at start-up before entering the main function as it involves multiple device resets. The diagnostic supports both the scenario where the WWDT is enabled (and thus locked) through the FUSE and when it is not. In the former scenario, the diagnostic execution time will depend on the timeout period chosen for the WWDT while in the latter scenario the WWDT is enabled with the shortest WWDT timeout period and disabled upon exiting the diagnostic.
This diagnostic function assumes global interrupts are disabled.
Timer/Counter A (TCA) is used to verify the timing of the WWDT clock source since the TCA clock source is independent. The timer is set up and teared down as part of running the diagnostic. It is assumed that the timer resource is free at start-up before entering main.
-
A system reset occurs.
-
Back up the reset flags register (RSTFR) and clear it.
-
Enable the WWDT.
-
Measure the time it takes for the WWDT to issue a system reset.
-
Re-enter diagnostic and check that the system reset occurred.
-
Check that the system reset did not occur too soon or too late (with tolerance).
-
Check that the WWDT counter can be cleared in the open window without causing a system reset.
-
If the clearing did not work, wait for the open window to expire.
-
If no system reset is issued, no fault is detected.
-
Clear the WWDT counter in the closed window to trigger a system reset.
-
If no system reset is issued, a fault is detected.
-
Re-enter the diagnostic and store the result of the diagnostic.
-
Tear down the timer used for measurement and disable the WWDT.
-
DIAG_WWDT_GetResult() is called from main to get the result of the diagnostic.
Clears all reset flags in the RSTFR register. Use the DIAG_WWDT_GetRSTFRCopy() API to retrieve the copy of the register at start-up to handle unexpected resets in the application.
If the WWDT is enabled through fuses, it is the responsibility of the system integrator to issue the first WDR instruction (wdt_reset()) to start the first closed period when entering the main function.
None. |
None. |