-
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
RTIC v2 RTC monotonic drivers #804
Conversation
Ok, I just discovered a stress test freezing issue when building in release mode, which I had not really tested before. Please do not merge until I get this fixed. |
@kyp44 does the last commit address all the freezing issues? I'm hoping to have the time to read the PR in detail soon™. |
@jbeaurivage Yeah, this does fix the issue, which, despite taking me hours to troubleshoot, was a very simple fix. I am still letting the stress test run for a long period of time, but I am 98% confident that there will not be further issues. I like to wait at least 36 hours to get a hardware counter rollover to be sure. Here is a timer showing how much time is left. If you want to be sure not to waste any of your time, wait until this timer is done, and I will check in and confirm that it's still going. |
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 a few comments, some of which require changes, and some of which are at your discretion. But overall well done, this is some quality work!
Ideally I'd like to somehow get this tested on a thumbv6 target as a sanity check before merging.
By the way @kyp44, am I correct in my understanding that there are no breaking changes in this PR?
Oh also, not a big deal at all, but |
…ing the PR (atsamd-rs#804) * Adds #[hal_macro_helper] to functions as required and removes them from other, non-function items. * Adds documentation to `rtc::rtic::set_monotonic_prio` about the dependence on the RTIC static variable `RTIC_ASYNC_MAX_LOGICAL_PRIO`.
@jbeaurivage I just added comments to the particular items above as some require further discussion I think. The latest commit ( Regarding testing on thumbv6 targets, I may be getting a Feather M0 in the next couple of weeks to carry out and test the clocks v2 API work. If someone is able to test the monotonic in the meantime that would be great! I will also note that I just had the monotonic on the PyGamer running for over a week straight with no issues. As for breaking changes, this PR does technically have breaking changes, but it is something minor and silly. In particular, in the current |
…ing the PR (atsamd-rs#804) * Deprecates the entire `rtc::rtic::v1` module, which primarily just implements the old RTIC v1 `Monotonic` trait for `Rtc<Count32Mode>`. * Adds #[hal_macro_helper] to functions as required and removes them from other, non-function items. * Adds documentation to `rtc::rtic::set_monotonic_prio` about the dependence on the RTIC static variable `RTIC_ASYNC_MAX_LOGICAL_PRIO`.
78700c6
to
71b308c
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.
Ok, I've tested this on a SAMD21, and found it to be reasonably accurate. I found a few other minor discussion points. Once we've addressed all remaining items I'll definitely be ready to merge this.
…ing the PR (atsamd-rs#804) * Deprecates the entire `rtc::rtic::v1` module, which primarily just implements the old RTIC v1 `Monotonic` trait for `Rtc<Count32Mode>`. * Adds #[hal_macro_helper] to functions as required and removes them from other, non-function items. * Adds documentation to `rtc::rtic::set_monotonic_prio` about the dependence on the RTIC static variable `RTIC_ASYNC_MAX_LOGICAL_PRIO`.
71b308c
to
f43a341
Compare
…ing the PR (atsamd-rs#804) * Adds safety documentation to the `RtcMode` trait methods, and makes all methods safe to call. * Removes the RTIC-specific prelude and adjusts RTIC items in the crate-level prelude. * Updates the `rtic` module example to include notes about the `RTIC_ASYNC_MAX_LOGICAL_PRIO` static variable.
Just pushed a new commit ( It also occurred to me that, as far as I am tracking, breaking changes are confined to the Lastly, I think the only is pending issue is waiting for PR #807 to merge for the interrupt stuff. |
…d mode1 monotonics.
… and macros, now uses type-level programming to specify the RTC clock source at compile time.
…lication in the HAL. * Moves the two monotonics into their own files so that the `rtc::rtic` main module file is not so large and unwieldy. * Adds thorough documentation to the `rtc::rtic` module and its items, discussing the differences between the two monotonics, and how to use the macros to create them.
…lication. * Finally achieves ostensibly robust operation for both monotonics in which they can operate solidly for at least 12 hours under very heavy task load. * Adds in instrumentation to monitor the monotonics and panic with useful debugging messages if an abnormal condition or stall is detected.
…lication. * Major refactor to decouple the RTC mode from the monotonic backend type (basic or half-period counting). * This enables using half-period counting in mode 0 for SAMx5x chips without duplicating as much mode. * Updates and expands the documentation to account for the changes. * Leaves in the monitor instrumentation so it is captured in the new form.
… that the monotonics have been thoroughly tested.
…ons and moves RTIC-specific things, so they can be used for other purposes as well.
…sing the best RTC mode for the chip variant. Updates the documentation accordingly.
…ng things with the `build-all.py` script. * Renames the `wait_for_count_change` to `_wait_for_count_change` function name to suppress an unused warning for SAMD11/21 chips. * Fixes the `metro_m0` example `blinky_rtic.rs` to fix an RTIC v1 item location change.
…ess a freezing issue in release builds.
…ing the PR (atsamd-rs#804) * Deprecates the entire `rtc::rtic::v1` module, which primarily just implements the old RTIC v1 `Monotonic` trait for `Rtc<Count32Mode>`. * Adds #[hal_macro_helper] to functions as required and removes them from other, non-function items. * Adds documentation to `rtc::rtic::set_monotonic_prio` about the dependence on the RTIC static variable `RTIC_ASYNC_MAX_LOGICAL_PRIO`.
…ing the PR (atsamd-rs#804) * Adds safety documentation to the `RtcMode` trait methods, and makes all methods safe to call. * Removes the RTIC-specific prelude and adjusts RTIC items in the crate-level prelude. * Updates the `rtic` module example to include notes about the `RTIC_ASYNC_MAX_LOGICAL_PRIO` static variable.
…out merging the PR (atsamd-rs#804) * Adds the `from_numeric` method to `interrupt::Priority` to create a variant from a numeric priority. * Removes the `rtc::rtic::cortex_logical2hw` function, instead using `interrupt::Priority::logical2hw`.
d3f23c7
to
c11b7d1
Compare
Summary
Adds RTC-based RTIC v2 monotonics drivers.
This addresses issue #765 and is the culmination of a lot of discussion there.
Note that it was decided along with the RTIC team that ATSAMD RTIC monotonics should be released as part of the HAL instead of in
rtic-monotonics
.Note that this release of the monotonics is opinionated in the sense that only the best monotonic is provided for each chip variant. See the module documentation of
rtc::rtic
for details. For reference, the alternative of releasing two monotonics, one for each RTC mode, is preserved in thertic-v2-rtc-monotonics-full
branch. Compare the module documentation ofrtc::rtic
in that branch for details on why there is clearly a best choice for each chip variant.Checklist