-
Notifications
You must be signed in to change notification settings - Fork 178
Documentation update on tickless mode porting guide #1337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
When the tickless mode is enabled, the device suspends the kernel effectively disabling the systick and sets up the [low power ticker] through [mbed::internal::OsTimer]. | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we just merge a PR that meant you didn't have to set this if you don't have a low power ticker at all? It's bright enough to realise that it has to use us-ticker now. So I think you only have to set this if you have it and it doesn't work well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that PR has been merged, the "if the target does not feature a low power ticker" condition is no longer true.
How about "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."
Then "If tickless mode uses the microsecond ticker, the device will only enter sleep rather than deepsleep, but will still avoid unnecessary tick calls."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked, and the PR is still pending, but ready for merge:
6a9ab05
to
0aea8cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "tickless" diagram isn't quite right, because it shows "SysTick" being used as the timer. All the ticks are and wakeup from idle are actually coming from "lpticker" (or "usticker").
(In principle the ticks could be SysTick and the wake from idle lpticker, so it could be hybrid, but for now it's all lpticker).
|
||
When the tickless mode is enabled, the device suspends the kernel effectively disabling the systick and sets up the [low power ticker] through [mbed::internal::OsTimer]. | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that PR has been merged, the "if the target does not feature a low power ticker" condition is no longer true.
How about "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."
Then "If tickless mode uses the microsecond ticker, the device will only enter sleep rather than deepsleep, but will still avoid unnecessary tick calls."
0aea8cd
to
1554e16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeating my earlier comment:
All the ticks [...] and wakeup from idle are actually coming from "lpticker" (or "usticker")
Your diagram is still showing SysTick in use for tickless.
Another minor detail - don't think it's worth putting in the diagram, but for your benefit - it can actually use two lpticker interrupts to wake from a sleep. First one brings it out of deep sleep, and it's scheduled early enough to guarantee it's not late, then it goes back to shallow sleep scheduling wakeup for the exact requested time.
|
||
If tickless mode uses the microsecond ticker, the device will only enter sleep rather than deep sleep, but will still avoid unnecessary tick calls. | ||
|
||
*Note that using the tickless mode prevents the user from using the associated timer.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, never spotted this sentence. Where did it come from?
It's not true in any meaningful sense for users. There is one HAL lpticker and one HAL usticker, yes, but they are always shared by the "ticker_api" framework. The OS timing uses that same sharing mechanism along with Ticker
, LowPowerTimeout
etc, and doesn't interfere with their use.
You couldn't use LowPowerTicker
or MBED_TICKLESS
at the same time as directly calling the HAL lpticker interrupt APIs yourself, but no-one would ever attempt that, I hope.
|
||
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. | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit wary about mentioning mbed::internal::
anything in documentation, but I guess it's a potentially useful detail for anyone debugging/maintaining the code.
1554e16
to
8917702
Compare
8917702
to
3a9ec86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tickless diagram is difficult to read. Please update it.
Co-authored-by: Irit Arkin <[email protected]>
1e84cfd
to
a970fa0
Compare
It would be useful if the digrams show SysTick (and "lpticker" or "usticker") in (equal) periods of 1ms. |
e0057e8
to
42c3b4a
Compare
42c3b4a
to
9d09e3c
Compare
] | ||
``` | ||
|
||
When tickless mode is enabled, Mbed OS's default [OsTimer](../mbed-os-api-doxy/structos__timer__def.html) based on the [low power ticker](../mbed-os-api-doxy/group__hal__lp__ticker.html) replaces SysTick. If a target's low power ticker has an excessively long wake-up time or other performance issues, make it use the [microsecond ticker](../mbed-os-api-doxy/group__hal__us__ticker.html) instead by adding the below configuration in 'target.json' (in your target's section). And this configuration is not required for the target which does not have low power ticker as the default OsTimer based on the microsecond ticker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When tickless mode is enabled, Mbed OS's default [OsTimer](../mbed-os-api-doxy/structos__timer__def.html) based on the [low power ticker](../mbed-os-api-doxy/group__hal__lp__ticker.html) replaces SysTick. If a target's low power ticker has an excessively long wake-up time or other performance issues, make it use the [microsecond ticker](../mbed-os-api-doxy/group__hal__us__ticker.html) instead by adding the below configuration in 'target.json' (in your target's section). And this configuration is not required for the target which does not have low power ticker as the default OsTimer based on the microsecond ticker. | |
When tickless mode is enabled, Mbed OS's default [OsTimer](../mbed-os-api-doxy/structos__timer__def.html), based on the [low power ticker](../mbed-os-api-doxy/group__hal__lp__ticker.html), replaces SysTick. If a target's low power ticker has an excessively long wake-up time or other performance issues, make it use the [microsecond ticker](../mbed-os-api-doxy/group__hal__us__ticker.html) instead, by adding the `tickless-from-us-ticker` configuration in 'target.json' (in your target's section). This configuration is not required for a target that does not have low power ticker, because it will default to the microsecond ticker. |
I'm happy to merge; just need to know if it's 6.1 only, or can join 6.0 as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the nice update on the diagrams.
To be honest, the next release is so close that it may as well go into development; it will be published in less than two weeks anyway |
Anyway, need to do more work on the development branch, as this will not be visible - it's not in the JSON |
Updated tickless mode porting guide with missing information and done some cleanup.
This PR depends on ARMmbed/mbed-os#12988