-
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
drivers/sx127x: pkg/semtech-loramac: replace xtimer by ztimer #14547
Conversation
Would be nice if you start posting your test results ouput in the PR description. |
I'll run the release tests for both applications :) |
All good with
|
|
Hmm seems to be an issue with iotlab boards, works with locally connected boards:
|
@aabadie changes make sense and are working, once you take a look at my |
BTW works with |
5b8becd
to
161c1da
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.
ACK.
@aabadie murdock spotted many conflicts, can you take a look? |
There were several issues:
I can provide the last 2 commits in separate PRs to ease review if you want. |
8484474
to
2ce34f8
Compare
@@ -6,6 +6,9 @@ USEMODULE += semtech_loramac_mac_region | |||
USEMODULE += semtech_loramac_crypto | |||
USEMODULE += semtech_loramac_arch | |||
|
|||
USEMODULE += ztimer_msec | |||
USEMODULE += ztimer_periph_rtt |
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.
USEMODULE += ztimer_periph_rtt | |
# If RTT feature is available use the RTT backend of ztimer | |
FEATURES_OPTIONAL += periph_rtt | |
ifneq (,$(filter periph_rtt,$(FEATURES_USED))) | |
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.
I prefer keeping the actual state for the loramac pkg: it's important to ensure that the rtt is used because of the duty-cycle timer. In a deep sleep mode with RAM retention, a regular timer will be stopped but not a rtt based 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.
But why enforce it? Low Power modes are not enabled by default, only examples/lorawan
does that.
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.
ztimer is an internal implementation detail of the package adaption to RIOT. There's no need to enforce developers to add this dependency in their lorawan 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.
I think is a question of keeping flexibility or having things that work out of the box. I think you want the later, that is OK for me since you are maintaining this. Can you then add some documentation to the pkg on the implementation status, I think it would be good to say why rtt
is required or when it is required. And in the same sense, what is needed for the pkg to work, what is needed for the pkg to work with sleep modes, etc... For me this is not very clear without having a knowledge of the code/implementation internals.
@aabadie The fact that |
only in standby mode. In stop mode, rtt can wakeup the cpu. It's not stm32 specific, it's just that |
Ok I guess this is just an examples, and |
b5efadd
to
79eea38
Compare
@aabadie only static tests did not pass, only #14547 (comment) has not yet been addressed |
79eea38
to
abfbc8a
Compare
squashed (to fix static tests) and added documentation to address #14547 (comment) |
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.
ACK, lets wait for murdock
Thanks for reviewing @fjmolinas ! |
Contribution description
This PR replaces the xtimer used by the sx127x radio driver and package semtech-loramac by the new ztimer and especially its rtt based backend version.
This should allow lower power consumption, even between the TX and RX windows phases, but it will also allow the use of STOP mode (with RAM retention) on STM32 without the need to disable the duty-cycle check. I tested this particular point with #11237 and this PR and now it works.
Note that to be able to use the RTT backend one cannot rely on usec precision timers. msec precision delays cannot be used with radio reset delays but loramac uses ms precision delays all the time, so it can be used there. As a result, all timeouts that were provided in microseconds are now converted to milliseconds.
Testing procedure
examples/lorawan
andpkg/semtech_loramac
are still functionalIssues/PRs references
Will be usefull for #11237