Skip to content

Commit abc2fb1

Browse files
committed
Add page about systick and tickless mode
1 parent 19be362 commit abc2fb1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/advanced/systick_tickless.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SysTick and tickless mode
2+
3+
## SysTick
4+
5+
System tick timer (SysTick) is a standard timer available on most Cortex-M cores. Its main purpose is to rise an
6+
interrupt with set frequency (usually 1ms). It can be used to perform any task in the system, but for platforms
7+
utilizing RTOS, including mbed OS, it provides an interval for the OS for counting the time and scheduling tasks.
8+
9+
mbed OS uses default SysTick source for most targets, but that can be overridden using the
10+
[Tick API](http://arm-software.github.io/CMSIS_5/RTOS2/html/group__CMSIS__RTOS__TickAPI.html) provided by CMSIS-RTOS2.
11+
12+
## Tickless mode
13+
14+
Tickless mode is an optimization mechanism available in RTOS for suspending the SysTick. It can be used in situations
15+
when RTOS will be idle for multiple ticks, allowing to achieve power savings by entering uninterrupted sleep. Targets
16+
implementing tickless mode will disable the SysTick, set up wake-up timer and enter sleep mode when idle. It will then exit
17+
sleep mode and re-enable the SysTick, when the timer expires or some event occurs (like external interrupt).
18+
19+
mbed OS supports the tickless mode on multiple targets, they will define `MBED_TICKLESS`
20+
macro in [targets/targets.json](https://github.com/ARMmbed/mbed-os/blob/master/targets/targets.json).
21+
22+
Targets supporting tickless mode will override the default SysTick mechanism and use
23+
[RtosTimer](https://github.com/ARMmbed/mbed-os/blob/master/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp) implementation based on
24+
[low power ticker](https://github.com/ARMmbed/mbed-os/blob/master/drivers/LowPowerTicker.h).
25+
This change is necessary to avoid drift connected with using two different timers to measure time. It should be mostly
26+
invisible for users, except that the low power ticker interrupt handler shouldn't be changed when tickless mode is in use.

0 commit comments

Comments
 (0)