Skip to content

Support for CH32 USBFS host mode #3094

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

Open
1 task done
joelpmichael opened this issue Apr 23, 2025 · 3 comments
Open
1 task done

Support for CH32 USBFS host mode #3094

joelpmichael opened this issue Apr 23, 2025 · 3 comments

Comments

@joelpmichael
Copy link
Contributor

Related area

New port support

Hardware specification

CH32 variant with USBFS, eg CH32V203C8T6 as used on the currently supported board ch32v203c_r0_1v0

Is your feature request related to a problem?

CH32 supports USB Host mode in the USBFS peripheral, but TinyUSB does not support it (yet)

Describe the solution you'd like

I have started writing support for the CH32 USBFS host mode, and it's now at the point where the USB host will enumerate some devices using the host/device_info example. It seems to enumerate another TinyUSB device using device/cdc_msc, displaying device strings as expected.

There are still timing-related issues in the driver, which is causing enumeration to fail on many devices. I also suspect I have issues with data0/data1 toggling as some devices are reporting STALL during enumeration. The code is available at https://github.com/joelpmichael/tinyusb/tree/ch32-usbfs-host but is definitely not ready for a PR yet. Once I can get it reliably enumerating a bunch of different devices I have (eg keyboard, mouse, mass storage, CDC-ACM, UARTs) I will send the PR through. If anyone wishes to check out the code and join the development, I will happily accept patches because I'm rapidly approaching the limit of my USB knowledge.

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.
@braxlan
Copy link

braxlan commented Apr 23, 2025

Have you seen PR 2793? Chances are high you've missed it because it is neither an issue, a discussion or part of the documentation.

@joelpmichael
Copy link
Contributor Author

I have not seen this one, thank you! I guess keep this bug open until it's merged, so it's a bit more visible that this support exists in the wild?

@braxlan
Copy link

braxlan commented Apr 24, 2025

That sounds like a good idea! I would love to see more people getting involved with the CH32 family because of its unique feature of having two USB ports which makes it ideal for dual-role projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants