Hi
The M5223x has a watchdog that generates an interrupt.
To use this as a watchdog (2s timeout) the following code can be used (whereby the WATCHDOG_2_SEC needs to be defines to suit the bus clock speed):
CWCR = (CWE | WATCHDOG_2_SEC | CWTA | CWTAVA | CWTIF);
fnSetIntHandler(SW_WD_VECTOR, (unsigned char *)_sw_wdog_timeout);
IC_ICR_0_8 = (INTERRUPT_LEVEL_7 | INTERRUPT_PRIORITY_7);
IC_IMRL_0 &= ~(SW_WDG_PIF_INT_L | MASK_ALL_INT);
The interrupt handler can reset the processor with something like:
static __interrupt__ void _sw_wdog_timeout(void)
{
RESET_RCR = SOFT_RST; // command a soft reset of the board
}
Regards
Mark