-
Notifications
You must be signed in to change notification settings - Fork 241
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
Full support for entering and exiting DORMANT mode #701
Conversation
… when changing to a non-aux source (e.g. reference clock changing to xosc). This allows us to turn off rosc if we want to.
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.
Thank you!
I had started doing things in that direction but never got to complete it 🤦.
Because the Dormant mode doesn't really need to be represented (the device does not run while in dormant mode).
I think Initialized
and Dormant
can be merged into a Unstable
state.
You can find my WIP here: https://github.com/ithinuel/rp-hal/tree/clock_dormant_recovery
Thanks @ithinuel, that's a good suggestion. I've replaced the XOSC I couldn’t see the benefit of adding |
Hi @ithinuel, is there anything I can do to help progress this PR? |
I never used the dormant state and didn't think about it enough to decide if these changes are sufficient to make dormant mode usable. From reading the diffs I get the impression that the changes make sense, and I don't see anything obviously wrong. @ithinuel, as you already worked on your own implementation of dormant support, you are probably more qualified to review this merge request. But if you don't have time to do a review, I could plug together some test setup on a breadboard to try out the example, and approve the PR if everything works as expected. @andrewh42, you wrote that you avoided breaking changes to make merging easier. As the next release probably will include breaking changes anyway, are there any improvements you'd want to add? |
Thanks for asking @jannic. I was thinking it could be useful to add an addiitional pll::State to represent a powered down PLL. At present the PLL's
And these transitions when stopping and then restarting (e.g. as part of going dormant):
Does that sound reasonable? Either way, I'd prefer to do this in a separate PR so this one doesn't stick around for too long and gather more complexity. Does that sound OK? |
Co-authored-by: Jan Niehusmann <[email protected]>
No worries @jannic, done. |
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.
Thanks, Andrew! I think the pull request can be merged now. @ithinuel, any objections?
BTW I also verified that the dormant mode actually makes a difference. Even with a cheap USB power meter, I see 0.02A in wfi mode, while in dormant mode, it shows 0.00A. The absolute numbers might be very inaccurate, but it's obvious that the dormant mode is different from the wfi sleep. |
I'm happy with this. We can always come back later to this if we need to make improvements. |
I noticed that there were the beginnings of some support for the RP2040 dormant lowest-power sleep but that several loose ends remained.
I've taken care not to make any breaking changes in this pull request to maximise its prospects. However, I think an interesting future change would be to add an addiitional
pll::State
to represent a powered down PLL. This would streamline the process of restarting the PLLs following dormancy.Looking forward to your feedback and hopefully an approved pull request. I'm keen to hear of any areas that don't meet rp-rs standards or where I've done something that isn't idiomatic - apologies in advance for any crimes against these!
Andrew