Skip to content

Commit 6a9ab05

Browse files
committed
Documentation update on tickless mode porting guide
1 parent b191519 commit 6a9ab05

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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] based on target configuration.
22+
23+
If the target does not feature a low power ticker or has an excessively long wake-up time, you must also set the `tickless-from-us-ticker` to true in the target's section in the `targets.json` file. In such the device will only enter sleep rather than deepsleep.
24+
25+
*Note that using the tickless mode prevents the user from using the associated timer.*
26+
27+
The expected scheduling for the same use-case as previously described should look like :
28+
29+
![](./resources/Tickless.png)
30+
31+
# Testing
32+
33+
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.
34+
35+
# References
36+
37+
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)