sys/ztimer: add power management for ztimer clocks#13722
sys/ztimer: add power management for ztimer clocks#13722benpicco merged 2 commits intoRIOT-OS:masterfrom
Conversation
sys/include/ztimer.h
Outdated
| ztimer_now_t checkpoint; /**< cumulated time at last now() call */ | ||
| #endif | ||
| #if MODULE_PM_LAYERED | ||
| int8_t required_pm_mode; /**< min. pm mode required for the clock to run */ |
There was a problem hiding this comment.
Not sure about using -1 here as a value. 0 is idle and then we have four additional modes. I would be a fan of 255 as an invalid mode, as it is also "below" the deepest sleep mode.
There was a problem hiding this comment.
Okay good point.
Thinking about this a second time, I would rather define ZTIMER_NO_REQUIRED_PM_MODE and use this instead of checking magic numbers. Would you agree?
|
Without knowing all the details about ztimer this looks straightforward. However, is it possible to have the same physical hardware timer for the usec and msec timer? If so, it could be possible to specify different required pm modes. |
|
Thank you for looking into this PR!
Yes, by default If you want to have a |
|
Sorry for not giving feedback earlier. I think we should try as proposed here. I thought I could do some actual power measurement, but most of my gear is unavailable due to the quarantine. :( |
|
@kaspar030 don't worry. I also have to stick with the power measurement included in the SAMR30-XPRO board. It is not that accurate, but I can tell if the board is drawing 10uA or 100uA. |
|
Is there anything I could do to support the review of this PR? |
|
@jue89 please rebase and squash! |
7fd71dc to
73e2261
Compare
Contribution description
This is a follow-up of #13585. After some discussion with @kaspar030 I came up with an implementation of his approach.
The basic idea / assumptions behind this PR:
ZTIMER_USECclock.ztimer_tis running on theZTIMER_USECclock.ztimer_trequires theZTIMER_USECclock and unblocks it if noztimer_tis running onZTIMER_USEC.Testing procedure
I'll describe the testing procedure later if the over-all architecture is considered acceptable
Issues/PRs references
Closes #13585
Closes #13580