I have a tricky bug that is not reproducible in a larger project.
The reset source is a watchdog reset.
I have seen in the user guide (page: 87) that I can configure the watchdog to call an interrupt and not just perform a reset. I would like to use this to analyse the stack to perhaps get an idea of where the problem is.
I have inserted the line in the init routine for this:
SysCtrlRegister.SCSR.AsWord = 0x02; // Items.WD_ENINT = 1; // enable Watchdog interrupt
static void InitWatchDog(void)
{
EALLOW();
// Setup WatchDog
// set check bits and set prescale to max, set disable to 0 (enable watchdog),
// keep WDFLAG bit as is
// Watchdog period is set to Oscillator Cycletime (10MHz, 100nsec) * 512 * 64 * 256
// = 100 nsec * 512 * 64 * 256 = 851.97 msec
// 512: osc divide, 64: wd prescaler (max, used here), 256: 8-bit WD counter, 6: PLL multiplier (WD runs at ext. Clk rate)
// -> WD decrements every 512*64*6 = 32768*6 = 196608 cycles
Watchdog.WDCR.AsWord = (WDCHK_MASK | WDPS_512_64);
SysCtrlRegister.SCSR.AsWord = 0x02; // Items.WD_ENINT = 1; // enable Watchdog interrupt
EDIS();
}
The debugger shows the value 0x07 for SYSCTRL.SCSR, which seems to be correct.
For testing the interrupt, i call an method with infinte loop after some secs.
But now nothing happed, not even a reset.
i checked every ISR (also NOTUSED and NMI_ISR), but non of them is called.
I think I'm missing some enable, but I don't know which one
Please help. Thanks