-
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
boards/samr30-xpro: add ztimer configuration #14031
Conversation
13b819c
to
962825a
Compare
Murdock is not happy. |
ping @jue89! |
ping 😉 |
ping @jue89! |
Whoops. This PR slipped through. |
boards/samr30-xpro/Makefile.dep
Outdated
|
||
ifneq (,$(filter ztimer_msec,$(USEMODULE))) | ||
USEMODULE += ztimer_periph_rtt | ||
endif |
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.
this one can get in by simply dropping this change @jue89, care to rebase?
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.
I can't remember ... what was the problem with this change?
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.
Since a while periph_rtt
is the default ztimer_msec
backend, except for some BOARDs, among them sam0 BOARDs since it was shown that the rtt overhead was to high to be able to implement a good enough msec
timer by default (see #17395):
Lines 81 to 90 in f298d0a
# NOTE: select the module here and not in the CPU so that order of inclusion | |
# does not have periph_rtt selected earlier that it should be while at the same | |
# time avoiding the module 'ztimer-no_periph_rtt' being included unecesarily. | |
# The sam0 rtt busy loops for 180us every time an alarm is set or | |
# the counter is read, this propagates and leads to timing errors | |
# on ztimer_msec that are higher than > +-1msec. | |
# The same goes for the fe310 rtt. | |
ifneq (,$(filter sam% fe310,$(CPU))) | |
USEMODULE += ztimer_no_periph_rtt | |
endif |
I I just ran USEMODULE=ztimer_periph_rtt IOTLAB_NODE=samr30-1.saclay.iot-lab.info BOARD=samr30-xpro make -C tests/bench_ztimer/
for samr30 and it looks OK:
main(): This is RIOT! (Version: 2022.04-devel-798-g8fa26-HEAD)
ztimer benchmark application.
set() one 121995 / 1000 = 121
remove() one 1544 / 1000 = 1
set() + remove() one 243996 / 1000 = 243
set() many increasing target 138007 / 1000 = 138
re-set() first 122001 / 1000 = 122
re-set() middle 122100 / 1000 = 122
re-set() last 122192 / 1000 = 122
remove() + set() first 244009 / 1000 = 244
remove() + set() middle 243983 / 1000 = 243
remove() + set() last 243982 / 1000 = 243
remove() many decreasing 203144 / 1000 = 203
ztimer_now() 7506 / 1000 = 7
sizeof(ztimer_t) 16000 / 1000 = 16
done.
So it looks like the sam%
blacklist was a bit too strict and we can remove sam3
.
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.
Well, that patch completely breaks our application. We need ZTIMER_MSEC
running on periph_rtt
. Yes, high RTT_MIN_OFFSETS
are required, but with that in place, the application just works fine even with all these busy loops. We don't have another choice for battery applications.
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.
Note that ztimer_no_periph_rtt
does not impede including ztimer_periph_rtt
it just does not enable it by default. So I don't see why that would break your application.
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.
I also ran RTT_MIN_OFFSET
for the BOARD and it yiels:
RTT_MIN_OFFSET for samr30-xpro over 1024 samples: 8
So quite OK, I think we should re-enable it.
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.
So quite OK, I think we should re-enable it.
Ah wait this is already configured
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.
So I don't see why that would break your application.
That line made me saying this ;-)
Lines 88 to 90 in df80860
ifneq (,$(filter sam% fe310,$(CPU))) | |
USEMODULE += ztimer_no_periph_rtt | |
endif |
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.
Yes but it only prevents "auto-inclusion", it doesn't forbid an application from till requesting, so you can have:
USEMODULE += ztimer_no_periph_rtt ztimer_periph_rtt
.
I'll open a PR re-enabling sam3
@jue89, ping! |
962825a
to
d6af2c4
Compare
d6af2c4
to
dda35f4
Compare
dda35f4
to
96ac811
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.
I rebased, and re-ran tests/ztimer_overhead
and adapted the values, @jue89 care to confirm?
main(): This is RIOT! (Version: 2022.04-devel-780-gdda35-feature/board_samr30-xpro_ztimer)
ZTIMER_USEC auto_adjust params:
ZTIMER_USEC->adjust_set = 19
ZTIMER_USEC->adjust_sleep = 23
ZTIMER_USEC auto_adjust params cleared
zitmer_overhead_set...
min=19 max=19 avg_diff=19
zitmer_overhead_sleep...
min=23 max=23 avg_diff=23
ZTIMER_USEC adjust params for samr30-xpro:
CONFIG_ZTIMER_USEC_ADJUST_SET 19
CONFIG_ZTIMER_USEC_ADJUST_SLEEP 23
Thank you for pinging me and rebasing on master! I think this PR need some rework:
|
Then maybe we can just split the adjust parameters? |
Okay, I can split the PR. But we gave up on the direct interaction of |
@jue89 should we split the adjust parameters and close this one then? |
I'd love to just close this in favor of:
Would someone object? |
I think you can go ahead. |
Contribution description
This PR adds ztimer configuration for the
samr30-xpro
board. This should reduce its power consumption when no timer is running on theZTIMER_USEC
clock.Testing procedure
make -C tests/ztimer_pm_layered BOARD=samr30-xpro flash term
Expected output:
make -C tests/ztimer_overhead BOARD=samr30-xpro flash term
Expected output:
Issues/PRs references
#13722