Skip to content

Commit 1554e16

Browse files
committed
Documentation update on tickless mode porting guide
1 parent b191519 commit 1554e16

File tree

5 files changed

+39
-20
lines changed

5 files changed

+39
-20
lines changed

docs/porting/target/tickless.md

Lines changed: 0 additions & 20 deletions
This file was deleted.
Loading
1.29 KB
Loading
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Tickless mode is an optimization mechanism available in RTOS for suspending the SysTick. You can use it in situations when RTOS is idle for multiple ticks, so you can achieve power savings by entering uninterrupted sleep.
2+
3+
# Reminder on scheduling & sleep modes in Mbed OS
4+
5+
Mbed OS uses the SysTick timer at period of 1ms to process threads' scheduling.
6+
For instance, a system running two threads would see its timing diagram look like :
7+
8+
![](./resources/Normal_Tick.png)
9+
10+
Note how the device never enters deepsleep and wastes cycles in Systick while all thread are asleep.
11+
12+
# Tickless mode
13+
14+
To support tickless mode in Mbed OS, your target needs to meet two requirements:
15+
16+
- Support for Sleep HAL API
17+
- Support for either Low Power or Microsecond Ticker HAL API
18+
19+
To enable tickless mode support in Mbed OS, you need to add the `MBED_TICKLESS` macro in the macros option of the target's section in the `targets.json` file.
20+
21+
When the tickless mode is enabled, the device suspends the kernel effectively disabling the systick and sets up either the [low power ticker](../mbed-os-api-doxy/group__hal__lp__ticker.html) or [microsecond ticker](../mbed-os-api-doxy/group__hal__us__ticker.html) through [mbed::internal::OsTimer](../mbed-os-api-doxy/structos__timer__def.html) based on target configuration.
22+
23+
By default, tickless mode uses the low-power ticker if available. If a target's low-power ticker has an excessively long wake-up time or other performance issues, you must set tickless-from-us-ticker to true in the target's section in the targets.json file to make it use the microsecond ticker instead.
24+
25+
If tickless mode uses the microsecond ticker, the device will only enter sleep rather than deep sleep, but will still avoid unnecessary tick calls.
26+
27+
*Note that using the tickless mode prevents the user from using the associated timer.*
28+
29+
The expected scheduling for the same use-case as previously described should look like :
30+
31+
![](./resources/Tickless.png)
32+
33+
# Testing
34+
35+
There are no dedicated tests validating tickless mode. Running all Mbed OS tests suites, with particular focus on HAL sleep and HAL low power ticker tests, provides sufficient coverage.
36+
37+
# References
38+
39+
You can find more details on sleep modes in mbed in the section : [Mbed OS power management sleep](../../../apis/power-management-sleep.html)

0 commit comments

Comments
 (0)