-
Notifications
You must be signed in to change notification settings - Fork 216
USB using Clock v2 #916
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
base: master
Are you sure you want to change the base?
USB using Clock v2 #916
Conversation
Added the three clocks to the inner struct so they can be held onto. Added a generic so that the correct Pclk source can be inferred. Added a free method so the user can get those back when they're done with the usb
Co-authored-by: Ashcon Mohseninia (RAND_ASH) <[email protected]>
This looks really good in terms of how it uses the |
@supersimple33 @kyp44 the USB Clock check for 48Mhz is something i opened in #884 . So maybe look at that PR for inspiration should it not get merged |
@supersimple33 I would recommended checking the clock rate and returning a |
dm: impl AnyPin<Id = PA24>, | ||
dp: impl AnyPin<Id = PA25>, | ||
) -> UsbBusAllocator<UsbBus<G>> { | ||
// SWITCH DFLL INTO USB CLOCK RECOVERY MODE - THIS ALLOWS FOR MORE ACCURATE USB |
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 suggest moving the comment about clock recovery mode in to the docstring for the method, so that it shows up in docs (or Rust Analyzer etc). Also, I'm pretty sure it's required to use USBCRM if running USB with the DFLL clock source, so not sure "more accurate" is the right way to describe it.
A number of the USB examples for BSPs or their examples are now broken. This can be checked locally by running the |
Yes, the examples need to be updated for the T1 BSPs, but I don't think we need to keep them all building for every commit in the history. IOW, if some examples need peripheral A and B both updated to clock v2, we could leave the examples broken in the peripheral A PR, base the peripheral B PR on to the A branch, and fix the examples there. The USB examples are problematic in their use of static mut references as well; we should fix that independently of the clock v2 work. It would probably be a little easier to do that first, rebasing this on top of the static mut ref fix. |
@kyp44 I'd suggest that while working the Git stuff out, you keep one copy of your work based off master as usual, so you're a bit freer to experiment with other copies. To make the backup, with your branch checked out just do:
You'll then need to make your local repo aware of the repo that has the work you want to rebase yours on to. In this case, I guess that'll be supersimple33's GH - add that as a remote like:
Finally, you can rebase your work on to a commit from that branch. Keep in mind that in Git, a branch is just a named pointer to a commit (if you haven't come across Git Internals, I feel like it's well worth the time to read it closely and work through the examples).
|
@ianrrees But then my PR will include changes from the other PR as well. Is that not a problem? Does it mean that the other PR has to be merged first? |
@kyp44 You're right that if one PRed branch (for feature A) is based on another PRed branch (for feature B) that the first PR will look a lot bigger (the diff between master and A+B). I don't think that's inherently a problem, but it does require a bit more Git-fu to work through. I guess there are a few related things going on here: If you're wanting a context that has both sets of changes, e.g. to update examples, then you could use this approach to update the examples but PR just your set of changes. This would involve maintaining two branches for There are multiple approaches we can consider to manage the PRs that will be involved in the clock v2 migration. One option is to proceed as usual, with each PR being a self-contained change to Third is the question of updating peripherals to |
Gotcha, I think for the examples going forward (including the one discussed above for the DSU/USB migrations) I'll just make a note in the breaking PR and make a note to fix it once both have been merged. I think it would have been good to have done a I agree that it's it's worth waiting for the |
Summary
I have migrated the UsbBus to Clocks V2. That said I don't have a lot of experience with this stuff and I wasn't sure what I should consume and what I should hold onto or if this is even the right way to go about this. That said I tested my changes on the gc4 and they worked.
See #912