This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Is there a way to get a program counter (PC) just before a watchdog timer reset occurs?

We have implemented a watchdog timer that will reset the CPU if it is not serviced within 250ms.  I can read the watchdog status register upon reset and figure out that it barked.  But that does not help me to find out the cause.   Can I intercept the NMI hander that resets the CPU and store away the PC in flash at this point?   Where whould I find this NMI handler?

Thanks in advance.

  • Chris,

    Hi Chris,

    Did you configure the watchdog to generate an NMI instead of a Reset?
    This can be done through the register RTIWWDRXNCTRL.

    The NMI interrupt is routed to the FIQ interrupt vector. So put your breakpoint at address 0x1C to catch the exception, then check LR_FIQ to find out what code you interrupted with the watchdog expiration.

    Of course also make sure that the FIQ interrupt mask (F bit in CPSR) is cleared so that FIQs are not disabled.
    Even though they are NMI when you come out of reset they are initially disabled.
    They are NMI because once enabled by software, they cannot be disabled by software subsequently. But they need to be enabled once.

    -Anthony