- Write the timer values
WKUP_COUNTandWDOG_COUNTto zero. - Program the desired wakeup pre-scaler value in
WKUP_CTRL. - Program the desired thresholds in
WKUP_THOLD,WDOG_BARK_THOLDandWDOG_BITE_THOLD. - Set the enable bit to 1 in the
WKUP_CTRL/WDOG_CTRLregisters. - If desired, lock the watchdog configuration by writing 1 to the
regwenbit inWDOG_REGWEN.
Pet the watchdog by writing zero to the 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 WKUP_CTRL or clearing the timer value in WKUP_COUNT.
Clear the interrupt by writing 1 into the Interrupt Status Register INTR_STATE.
If the timer has caused a wakeup event (WKUP_CAUSE is set) then clear the wakeup request by writing 0 to WKUP_CAUSE.
If 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.