The MPU watchdog timer (MPU_WD_TIMER) implements one channel for the single MPU core (MPU_WD_TIMER_C0). The MPU_WD_TIMER operates on MPU subsystem clock (MPU_DPLL_CLK).
The MPU_WD_TIMER_C0 channel implements:
- A 32-bit decrementing counter which has a period set by the value loaded into the counter (via the WDT_LOAD_REGISTER_0[31:0] NEWCOUNT bit field) and the prescaler ratio (set via the WDT_PRESCALER_REGISTER_0[9:0] PRESCALER bit field). The period is calculated as follows: TMPU_WD_TIMER_C0 = (PRESCALER + 1) x (NEWCOUNT + 1) / f(MPU_DPLL_CLK).
- Two interrupt output signals (WARN, INTR)
- One reset request output (MPUSSRST)
The counter starts decrementing when the WDT_CONTROL_REGISTER_0[0] ENABLE bit is set to 0x1. The current count value can be monitored by reading the WDT_COUNT_REGISTER_0[31:0] CURRENTCOUNT bit field. When the counter reaches zero, a timeout condition occurs. In the timeout condition, the counter stops counting and:
- MPU_WD_TIMER_C0_IRQ interrupt is generated to the MPU_INTC, if enabled by setting the WDT_CONTROL_REGISTER_0[1] INTREN bit to 0x1.
- Reset request is generated to the global PRCM, if enabled by setting the WDT_CONTROL_REGISTER_0[3] MPUSSRSTEN bit to 0x1.
Note: If the MPU core is in debug state, the MPU_WD_TIMER_C0 counter does not decrement until the MPU core returns to non-debug state. Debug state is inferred by monitoring the DBGACK signal of the MPU core.
Additionally, the user can also setup a warning condition which can be used to signal an interrupt that gives software a notice when the MPU_WD_TIMER_C0 is getting close to a timeout. The threshold value is set in the WDT_WARNING_REGISTER_0[31:0] WARNING_WATERMARK bit field. The current count value is then compared to the threshold (warning watermark) level value and when CURRENTCOUNT = WARNING_WATERMARK, a warning interrupt (MPU_WD_TIMER_C0_IRQ_WARN) is generated to the MPU_INTC (if enabled by setting the WDT_CONTROL_REGISTER_0[1] WARNEN bit to 0x1).
The mapping of the two MPU_WD_TIMER_C0 interrupts is as follows:
- MPU_WD_TIMER_C0_IRQ_WARN mapped to MPU_IRQ_5
- MPU_WD_TIMER_C0_IRQ mapped to MPU_IRQ_139
The user can also poll the following status bits:
The following programming guidelines should be taken into account:
- The WDT_PRESCALER_REGISTER_0 register should be written (if needed) before the WDT_LOAD_REGISTER_0 register is written. This is because when the WDT_LOAD_REGISTER_0 register is written, the WDT_COUNT_REGISTER_0 register is immediately updated with this value and at the same time, the PRESCALER value is sampled to be used by the decrement logic which controls the WDT_COUNT_REGISTER_0 register.
- The WDT_WARNING_REGISTER_0 and WDT_LOAD_REGISTER_0 registers should be written before the MPU_WD_TIMER_C0 is enabled (WDT_CONTROL_REGISTER_0[0] ENABLE = 0x1). Otherwise, interrupts and reset request may be asserted immediately depending on the state of these registers. For example, after reset these registers have '0' and if the WDT_CONTROL_REGISTER register is configured to enable the corresponding interrupts and reset request, and then MPU_WD_TIMER_C0 is enabled, interrupts and reset request are immediately asserted.
The suggested programming order is as follows:
- Set the warning watermark level (WDT_WARNING_REGISTER_0), if needed
- Set the prescaler ratio (WDT_PRESCALER_REGISTER_0[9:0] PRESCALER)
- Set the new count value (WDT_LOAD_REGISTER_0)
- Enable corresponding interrupts and reset request in WDT_CONTROL_REGISTER_0, if needed
- Enable MPU_WD_TIMER_C0 (WDT_CONTROL_REGISTER_0[0] ENABLE = 0x1)
Note: When the MPU core is going to low power state, the MPU_WD_TIMER may need to be disabled. If it is not disabled, then the MPU_WD_TIMER may timeout (since the MPU core is not refreshing the timeout counters) and will generate MPUSS reset request which will reset the MPU domain.