See the block diagram for high level function and connectivity. The timer interacts with the CPU core and the power manager and reset manager to drive wakeup / reset events and interrupts. There is also an extra input to tell the counter whether to run (“counter-run”). This is used to stop the watchdog timer running when in debugging mode or when the alert handler has put the system in a “killed” state.
{{< incGenFromIpDesc “../data/aon_timer.hjson” “hwcfg” >}}
The always-on timer will run on a ~200KHz clock. The timers themselves are 32b wide, giving a maximum timeout window of roughly ~6 hours. For the wakeup timer, the pre-scaler extends the maximum timeout to ~1000 days.
Register reads via the TLUL interface are synchronized to the slow clock using the “async” register generation feature. This means that writes can complete before the data has reached its underlying register in the slow clock domain. If software needs to guarantee completion of a register write, it can read back the register value (which will guarantee the completion of all previous writes to the peripheral).
regwen
bit in {{<regref“WDOG_REGWEN”>}}.Pet the watchdog by writing zero to the {{<regref“WDOG_COUNT”>}} register.
If either timer reaches the programmed threshold, interrupts are generated from the AON_TIMER module. Disable or reinitialize the wakeup timer if required by clearing the enable bit in {{<regref“WKUP_CTRL”>}} or clearing the timer value in {{<regref“WKUP_COUNT”>}}. Clear the interrupt by writing 1 into the Interrupt Status Register {{<regref “INTR_STATE”>}}.
If the timer has caused a wakeup event ({{<regref“WKUP_CAUSE”>}} is set) then clear the wakeup request by writing 0 to {{<regref“WKUP_CAUSE”>}}.
If {{<regref“WKUP_COUNT”>}} remains above the threshold after clearing the interrupt or wakeup event and the timer remains enabled, the interrupt and wakeup event will trigger again at the next clock tick.
{{< dif_listing “sw/device/lib/dif/dif_aon_timer.h” >}}
{{< incGenFromIpDesc “../data/aon_timer.hjson” “registers” >}}