90
F. Firouzi et al.
Fig. 2.33 How the system timer works and generates an interrupt
The SysTick timer counts down from a preloaded starting value to zero. SYSTCVR register holds current SysTick counter value. When the counter reaches zero,
a new starting value will be loaded to the timer. Note that the starting value is stored
in a register called SYST_RVR. SysTick counts down from a continuously lower
starting point as it starts at an incrementally lower point for each subsequent clock
cycle. The counter can be disabled by writing a zero value to the SYST-RVR register.
When the counter reaches zero, the COUNTFLAG status bit is designated at 1.
COUNTFLAG is one bit of SYST_CSR which controls the status of the timer. Note
that this special bit can trigger an interrupt in the system. Reading of the SYST-CSR
returns the value of COUNTFLAG to zero again (see Fig. 2.33) [15].
2.5.8 Low-Power Modes
In many IoT applications, it is very important that the deployed microcontroller
supports sleep mode capabilities to be able to suspend many or all operations to
reduce energy use, enabling it to run for many years with limited energy. ARM
microcontrollers generally use low-leakage technology and advanced design to
reach extremely low current consumption, making them an ideal option for batteryoperated or energy-harvesting IoT applications. Making the most of low-power
capabilities in IoT devices requires understanding the low-power modes currently
available. Typically, the following techniques are used to activate a low-power mode
in the Cortex-M series [8, 16]:
• Wait for Interrupt (WFI) Instruction – The low-power mode is utilized by this
instruction. In this low-power mode, the device will sleep until an interrupt or
exception occurs which wakes the device. Keep in mind that one must first enable
interrupts using a Nested Vectored Interrupted Controller (NVIC).
• Wait for Event (WFE) Instruction – Fundamentally, this instruction works similar
to WFT; however, it is more flexible than the WFT. Because of executing this
instruction, the device enters low-power mode. The main difference between
WFE and WFI is that WFE instruction allows the device to be woken up by
Précédent

- 99/647

Suivant