-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/ztimer/Makefilde.dep: periph_rtt as FEATURES_OPTIONAL #14013
Conversation
If ztimer_msec is used include periph_rtt as an optional feature, and if used include ztimer_periph_rtt.
I think I didn't make this a global default because some RTT cannot do 1000/1024 HZ. IIRC, some are glued to e.g., 1Hz. So I left it to be set in the board or cpu Makefile.dep. |
Ok, that is true, so it needs |
Another thought: To gain any power saving benefit by sourcing |
FYI: In #14031 I'm adding |
I think there is a question here on whether you always want |
I came to the conclusion that this is at least a good default. A timer system based on |
Depends on the platform, for |
Gentle reminder ;-) |
I don't think there was a conclusion here, I kind of contested my own PR hahhaha. |
After thinking some time about it, I would recommend to handle this at board-level. (Or cpu-level?) This reminds me of fixing #14031 ;) |
I'm still unsure about this because of #14013 (comment), 180us can be waaaay too much for some applications. |
Are you thinking of a certain application, which would break? (I'm asking bc we are actually living with that high delay.) |
I was using this for TSCH, and it was severely hindering the performance. |
IMO Also note that we don't expect the millisecond clock to be used for short running timers. And for long running timers the RTT likely has the lower clock drift - so even in scenarios that don't care about power consumption using the RTT for long running timers might be the better option. |
One good argument against is ROM consumption. |
Ok makes sense, to be fair in my case I was using the RTT but setting a 32Khz based ZTIMER,. So I'm convinced. |
So the remaining question is BOARD based approach or enable globally. We could filter by cpu that would not be able to do msec, from the top of my mind the only one is kinetis. |
I think we need compile time information about the RTT's capability ("can it do 1-32khz?"). So it might be most suitable to model this as feature, e.g., "periph_rtt_32khz". |
Reposting from #16334 (comment) This issue had also been tackled in #14013, but came to the same issues. I thought for RTT we should have features exposing But then how to configure it? So far it's compile-time, so conflict between configurations should be caught, for OpenWSN I set the highest possible speed, and for a lot of platforms, I made the So to summarize:
|
Note 32.000 kHz crystals do exist, while most boards actually use 32.768 kHz crystals. Also note that the feature is not really ztimer specific. How about calling the features
This would be especially useful for ztimer, as |
As stated in #16334 - I would do the following (haven't tried - just an idea):
Pro: Con: One backend may be compiled without being used. Modelling the RTT frequency as a feature doesn't scale, as @maribu already pointed out. What do you think? |
Sure. That makes sense as well, it will just need more though on how to translate used features to configuration of the RTT. |
I find this not transparent, you see both modules getting pulled in, you think cool, I'm using RTT I'll have low power, and actually, because the default frequency for that BOARD is |
How about displaying a warning, if |
I think we should probably list our goals then because there are a lot of mixed requirements. The basic most important one is: (1) use a low power timer backend when possible (so use PKG/Module needs: (2) OpenWSN needs at least 30us resolution from the And because of different modules with conflicting or overlapping needs: (3) solve different configuration requirements: e.g. Then nice to have: (4) configuring the timer backend in the most efficient way (no frequency conversion if needed, shifting over frac) For this modeling with What other needs are there? |
I think this is a patch, but not a complete solution, since you don't know what's going to happen from the dependency resolution. But we could have this as a first step since its probably the fastest to get rolling (and it's kind of there anyway) |
A patch is not the right word here, It's a solution for the current situation and allows to simply add
It sound good as a first step. |
Once Kconfig is first citizen, one could configure |
AFAIK dependencies are solved before configuration, and in this case |
I did not look specifically at the details discussed here, but in Kconfig the symbols that represent configurations and modules are all evaluated at the same time. So if I understood correctly, it is possible to do something like:
|
I don't know if it is weird to depend on a given configuration of one module to be able to activate another that uses it. I agree it is something we are not used to do currently, as we split the dependency resolution and the configuration of modules into steps. But if we can get the whole picture simultaneously I may even allow to have more control and validation of configurations. |
Superseded by #16553 |
Contribution description
If
ztimer_msec
is used includeperiph_rtt
as an optional features,and if used include
ztimer_periph_rtt
.This is based on the expectation that you want
ZTIMER_MSEC
to run in sleep mode.Testing procedure
ztimer_periph_rtt