DETECT THE SOURCE OF RESET
The first requirement is to find out the source of reset. This can be done by checking the WDRS bit in the CPU_SCR0 register. This bit is set in case of a watchdog reset event. The below code in the beginning of main.c can be used.
if(CPU_SCR0 & CPU_SCR0_WDRS_MASK)PRESERVE GLOBAL VARIABLES
{
// Reset is due to Watchdog
}
In order to recover from a watchdog reset and resume the application, it is necessary that the Global variables be preserved when the watchdog reset occurs. This can be done by setting the IRAMDIS bit in the CPU_SCR1 register. When this bit is set, all the cells marked “??” in the below table are preserved during a Watchdog reset (taken from Technical Reference Manual Section 3).
Write comment (0 Comments)



