Hi everyone. I've also posted this on the AT91 forums (incase anyone
reads that as well), but as no one has responded I'm posting here as
well.
I'm having an issue with the configuring the watchdog to a certain mode.
We have an issue in our system which causes it to log up and the
watchdog fires, this resetting the system. This works fine, but I'm
trying to configure the watchdog to fire an interrupt instead so I can
break at it and take a look at some stuff to try and figure out what
exactly is breaking. I seem to be failing at this though, so I was
wondering if anyone would be able to point out the mistake that I'm
making.
// Setup watchdog
AT91C_BASE_WDTC->WDTC_WDMR = 0xCF | (0xCF << 16) | AT91C_WDTC_WDFIEN |
AT91C_WDTC_WDDBGHLT | AT91C_WDTC_WDIDLEHLT;
// Enable interrupt
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SYS,
INTERRUPT_PRIORITY_SEVEN, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
InterruptServicer::Interrupt_ID_SYS);
// Enable AIC to catch the interrupt
AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);
And then inside the ISR:
U32 nWatchdogStatus = AT91C_BASE_WDTC->WDTC_WDSR;
if (nWatchdogStatus)
{
// put the below line in your ISR where you want the RESET...
RSTC_CR = RSTC_CR_PROCRST | RSTC_CR_PERRST | RSTC_KEY(0xA5);
}
I know the system interrupt part works as its the same interrupt that
the PIT timer hits, but the watchdog never seems to enter it. When the
watchdog fires the system just hangs, it never hits the if statement.
If I set up the watchdog to reset the system instead of cause an
interrupt, it works fine.
Anyone got any ideas as to what I might be doing wrong? Thanks!