The MPU watchdog timer (MPU_WD_TIMER) implements two channels, one per MPU core (MPU_WD_TIMER_C0 and MPU_WD_TIMER_C1, respectively; an unified name MPU_WD_TIMER_Cx is used hereafter in the chapter). The MPU_WD_TIMER operates on MPU subsystem clock (MPU_DPLL_CLK).
Each MPU_WD_TIMER_Cx channel implements:
- A 32-bit decrementing counter which has a period set by the value loaded into the counter (via the WDT_LOAD_REGISTER_i[31:0] NEWCOUNT bit field) and the prescaler ratio (set via the WDT_PRESCALER_REGISTER_i[9:0] PRESCALER bit field). The period is calculated as follows: TMPU_WD_TIMER_Cx = (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_i[0] ENABLE bit is set to 0x1. The current count value can be monitored by reading the WDT_COUNT_REGISTER_i[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_Cx_IRQ interrupt is generated to the MPU_INTC, if enabled by setting the WDT_CONTROL_REGISTER_i[1] INTREN bit to 0x1.
- Reset request is generated to the global PRCM, if enabled by setting the WDT_CONTROL_REGISTER_i[3] MPUSSRSTEN bit to 0x1.
Note: If the MPU core corresponding to the MPU_WD_TIMER_Cx channel is in debug state, the counter does not decrement until the MPU core returns to non-debug state. Debug state is inferred by monitoring the DBGACK signal corresponding to this 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_Cx is getting close to a timeout. The threshold value is set in the WDT_WARNING_REGISTER_i[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_Cx_IRQ_WARN) is generated to the MPU_INTC (if enabled by setting the WDT_CONTROL_REGISTER_i[1] WARNEN bit to 0x1).
The mapping of the four MPU_WD_TIMER interrupts is as follows:
- MPU_WD_TIMER_C0_IRQ_WARN mapped to MPU_IRQ_5
- MPU_WD_TIMER_C1_IRQ_WARN mapped to MPU_IRQ_6
- MPU_WD_TIMER_C0_IRQ mapped to MPU_IRQ_139
- MPU_WD_TIMER_C1_IRQ mapped to MPU_IRQ_140
The user can also poll the following status bits:
The following programming guidelines should be taken into account:
- The WDT_PRESCALER_REGISTER_i register should be written (if needed) before the WDT_LOAD_REGISTER_i register is written. This is because when the WDT_LOAD_REGISTER_i register is written, the WDT_COUNT_REGISTER_i 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_i register.
- The WDT_WARNING_REGISTER_i and WDT_LOAD_REGISTER_i registers should be written before the MPU_WD_TIMER_Cx is enabled (WDT_CONTROL_REGISTER_i[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_Cx is enabled, interrupts and reset request are immediately asserted.
The suggested programming order is as follows:
- Set the warning watermark level (WDT_WARNING_REGISTER_i), if needed
- Set the prescaler ratio (WDT_PRESCALER_REGISTER_i[9:0] PRESCALER)
- Set the new count value (WDT_LOAD_REGISTER_i)
- Enable corresponding interrupts and reset request in WDT_CONTROL_REGISTER_i, if needed
- Enable MPU_WD_TIMER_Cx (WDT_CONTROL_REGISTER_i[0] ENABLE = 0x1)
Note: When the MPU cores are 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, including both MPU cores.