-
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
cpu/samd21: Enable continuous read bit for periph_rtt #17403
base: master
Are you sure you want to change the base?
Conversation
With this PR I have missed IRQ
And with
|
f327486
to
3ba673c
Compare
Now |
3ba673c
to
67aa21c
Compare
I have some weird results @dylad, I tested once on IoT-LAB and It works:
But on local (over ssh) hardware I have it taking ages:
Can you push a remove c ommit seting the samples to 10 or something to see the result on the Murdock |
I re-tested on two samr21-xpro I have locally, and both have very large RTT_MIN_OFFSET=(33..320) maybe something special is going on with the iot-lab samr21-xpro? I tested all 15 and all of them had the same result with RTT_MIN_OFFSET=7, could it be something with the flasher? @aabadie is the anything different with them? |
sys/ztimer/Makefile.dep
Outdated
@@ -84,7 +84,7 @@ endif | |||
# 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))) | |||
ifneq (,$(filter sam3 fe310,$(CPU))) |
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.
BTW @dylad what sam%
based BOARDs do you have?
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 have access to SAML10/SAML11, SAML21, a SAMD21 mini clone and a SAME54
I don't have any 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.
sam3
uses a completely different driver, I wonder if it wasn't caught here by mistake.
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 I started this PR, this line was ifneq (,$(filter sam% fe310,$(CPU)))
Which include both sam0 and sam3.
With this PR, sam0 should work fine but since sam3 were disabled and no tests were run on it. I just leave it there.
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.
Should I remove it then ?
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'd say so
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 there will be a mismatch with sam3 Kconfig since this feature is also disabled in sam3 Kconfig
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.
Should be fixed.
Could you rebase? It would be nice to know if this brings improvement for |
Will do tonight. |
1e785f5
to
1abb847
Compare
Okay I've rebased this PR (and I really hope I didn't f*ck up something). |
Ah, Kconfig… |
1abb847
to
f35057e
Compare
f35057e
to
6398c5d
Compare
Signed-off-by: Dylan Laduranty <[email protected]>
@benpicco Could you check this PR with your |
With this PR on
with this patchdiff --git a/examples/timer_periodic_wakeup/Makefile b/examples/timer_periodic_wakeup/Makefile
index 9168c38eb5..c2ad1913ad 100644
--- a/examples/timer_periodic_wakeup/Makefile
+++ b/examples/timer_periodic_wakeup/Makefile
@@ -1,8 +1,11 @@
APPLICATION = timer_periodic_wakeup
RIOTBASE ?= $(CURDIR)/../..
+
BOARD ?= native
-USEMODULE += xtimer
-QUIET ?= 1
+
+USEMODULE += ztimer_msec
+
+USEMODULE += debug_irq_disable
# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
diff --git a/examples/timer_periodic_wakeup/main.c b/examples/timer_periodic_wakeup/main.c
index a1c91506cf..fca92a0f03 100644
--- a/examples/timer_periodic_wakeup/main.c
+++ b/examples/timer_periodic_wakeup/main.c
@@ -19,19 +19,19 @@
*/
#include <stdio.h>
-#include "xtimer.h"
+#include "ztimer.h"
#include "timex.h"
/* set interval to 1 second */
-#define INTERVAL (1U * US_PER_SEC)
+#define INTERVAL (1U * MS_PER_SEC)
int main(void)
{
- xtimer_ticks32_t last_wakeup = xtimer_now();
+ uint32_t last_wakeup = ztimer_now(ZTIMER_MSEC);
while(1) {
- xtimer_periodic_wakeup(&last_wakeup, INTERVAL);
- printf("slept until %" PRIu32 "\n", xtimer_usec_from_ticks(xtimer_now()));
+ ztimer_periodic_wakeup(ZTIMER_MSEC, &last_wakeup, INTERVAL);
+ printf("slept until %" PRIu32 "\n", ztimer_now(ZTIMER_MSEC));
}
return 0; Still slightly better than
With
|
This was partially cleans up in RIOT-OS#18423 but it looks like this one was missed. Signed-off-by: Dylan Laduranty <[email protected]>
I failed to understand why CI is complaining only for two |
How can we move this forward? |
Contribution description
This PR sets the continuous read bit in
READREQ
register for SAMD21. This will allows to continuously sync theCOUNT
register in order to avoid the heavy sync delay that currently exists on master.According to the datasheet, any write attempt on a write synchronized register will clear this bit, so we re-enables it after any
COUNT
orALARM
write for RTT driver. RTC is not affected by this PR.Since
READREQ
register is only defined for SAMDxx, others SAM0 families should not be affected by this PR.I don't know if this will have side effects so let the CI tests it.
Testing procedure
Check CI.
Can also be tested on hardware.
Issues/PRs references
Partial fix for #17395