Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1.69 KB

programmers_guide.md

File metadata and controls

27 lines (17 loc) · 1.69 KB

Programmer's Guide

Initialization

  1. Write the timer values WKUP_COUNT and WDOG_COUNT to zero.
  2. Program the desired wakeup pre-scaler value in WKUP_CTRL.
  3. Program the desired thresholds in WKUP_THOLD, WDOG_BARK_THOLD and WDOG_BITE_THOLD.
  4. Set the enable bit to 1 in the WKUP_CTRL / WDOG_CTRL registers.
  5. If desired, lock the watchdog configuration by writing 1 to the regwen bit in WDOG_REGWEN.

Watchdog pet

Pet the watchdog by writing zero to the WDOG_COUNT register.

Interrupt Handling

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.

Device Interface Functions (DIFs)