-
Notifications
You must be signed in to change notification settings - Fork 205
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
RTC broken on SAMD51G #501
Comments
i haven't fully tracked this down but it seems that maybe the #[cfg(feature = "rtic")]
impl Clock for Rtc<Count32Mode> {
const SCALING_FACTOR: Fraction = Fraction::new(1, 32_768);
type T = u32;
... so patching that, it then gets weirder. if i set breakpoints on -imagine a screenshot of but, without these specific breakpoints the idle task runs fine but the scheduled task never seems to occur. |
swapped to |
@TDHolmes I feel like you're the most likely person to have an idea what the issue could be. |
Yeah pretty confident my most recent RTC change broke our monotonic RTIC
implementation. I tried looking at this last weekend and couldn’t figure it
out before I ran out of time. I can look st this again Saturday
…On Tue, Oct 5, 2021 at 4:52 PM Paul Sajna ***@***.***> wrote:
@TDHolmes <https://github.com/TDHolmes> I feel like you're the most
likely person to have an idea what the issue could be.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#501 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC5YNWRHFF3GGR6CSCQOTF3UFOFUZANCNFSM5FI2M2SQ>
.
|
Ping @henrikssn too |
(with those couple of patches) that it works under debug but not while running has definitely thrown me, sorta seems like a race condition but it's unclear (to me) how a timer impl can cause this. i'm still trying to work out what's going on but it seems like updating from having a wee suspicious look at |
I pulled latest commit (3dc7f9) last night from master and tried the
Everything worked as expected. Maybe there is a difference between SAMD21 and SAMD51 in how the RTC works?
Honestly, I never tried the internal LP oscillator, but maybe this could be related to it not running in standby? Did you try commenting out (also, sorry for being late to the party) |
I've recently encountered the exact same issue on the SAME51J20A. The RTC monotonic clock doesn't work, and similarly adding breakpoints allows it to run. For anyone else that encounters this, one workaround is to add a delay in either fn clear_compare_flag(&mut self) {
self.mode0().intflag.write(|w| w.cmp0().set_bit());
for i in 1..10000 {
nop();
}
} Obviously, this is far from ideal. However, with this above change, everything works fine, including going to deep sleep along with My (uneducated) guess is that some weird synchronization issue is happening here. However, the datasheet makes no mention of needing synchronization for either |
hey there,
i've been messing around with trying to get the RTC (and RTIC) working on a
SAMD51G18A
with (almost) no success. attempting to useatsamd-hal@master
and[email protected]
. possibly related to: #488.i started with the setup from feather_m4/examples/sleeping_timer_rtc.rs which doesn't seem to actually kick off the RTC. looking at the datasheet the
count32_mode
function seems to be missing some steps, and there's a significant delta betweenRtc::count32_mode
andRtc::into_count32_mode
, in fact if one adds this line the RTC does start to function:so it's possible that was just missed in a previous refactor.
from there i've been attempting to use the RTC as a
Monotonic
source for RTIC per feather_m0/examples/blinky_rtic.rs. one can observe that the RTC is running via increasing values frommonotonics::now()
, scheduling immediately (via::spawn()
) works so the dispatcher would seem to be okay, but::spawn_after()
does not. attaching a debugger i can see the first call, but can't seem to step into the scheduling to see what it thinks it's doing.it's likely i've missed or misunderstood something, and some of this might be RTIC related, but, would definitely appreciate any advice y'all have ^_^
The text was updated successfully, but these errors were encountered: