ch32 USBHD/USBHS driver implementation#893
Open
Copper280z wants to merge 103 commits into
Open
Conversation
Lint ResultsFound 11 issues on changed lines in 4 files:
|
…ng to board definitions, add max packet size to usb device hal.
Grazfather
reviewed
Feb 7, 2026
| _reserved1: u2 = 0, | ||
| }); | ||
|
|
||
| fn baseAddr() usize { |
Collaborator
There was a problem hiding this comment.
this one actually makes sense
Grazfather
reviewed
Feb 10, 2026
Grazfather
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed everything except for the HALs themselves (since this is a draft). Will get to those when you think they're ready.
The previous `init() Self` returned a copy of the struct, but set up DMA in the same function, causing DMA registers to be programmed with addresses pointing into a stack temporary.
Rewrite hw_init to follow WCH SDK init sequence with raw register writes, fixing endpoint mode configuration (disable EP4 which shares DMA with EP0, only enable EP1-3 needed for CDC-ACM). Fix poll loop: mask out SOF in the ignore filter to prevent spinning, use single-pass with early return, and add EP0 OUT re-arm after IN completion to correctly handle SETUP toggle sequencing.
USBFS fixes + merge upstream
…nfig in v307 board def. v307 usbhs tested working on a ReleaseSmall build with 0.17.0-dev compiler.
…n HS and FS, fix ep_open and endpoint enabling.
…l 5sec enumeration delay.
Copper280z
marked this pull request as ready for review
July 19, 2026 03:28
piotrfila
reviewed
Jul 19, 2026
piotrfila
reviewed
Jul 19, 2026
piotrfila
reviewed
Jul 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new driver for the ch32 USBHD/USBHS peripheral, USB_OTG_FS peripheral, and examples for the ch32v307, and ch32v203 boards.