How enable watchdog timer for CF51223x nixheliet demo baord?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How enable watchdog timer for CF51223x nixheliet demo baord?

364 Views
TVNAIDU
Contributor III

How enable watchdog timer for CF51223x nixheliet demo baord?

Labels (1)
0 Kudos
1 Reply

228 Views
mjbcswitzerland
Specialist V

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

 

 

 

 

 

0 Kudos