Add Host support for ch32v20x usbfs
This PR adds HCD for WCH CH32V20x USBFS (USBOTG_FS).
The following issue will be closed:
- https://github.com/hathach/tinyusb/issues/2613
CH32V20x has two USB peripheral; FSDEV and USBFS. In this PR, USBFS Host driver is enabled when PORT=0 (FSDEV is selected).
I tested on my original CH32V203C8T6 board "Suzuno32RV" (8MHz external crystal, Type-A connector is assigned for USBFS, Type-C connector is for FSDEV). Please refer for schematic: https://github.com/verylowfreq/board_suzuno32rv
Thank you for your PR, can you pull/merge from master, which include a fix to circleci build.
@hathach Thanks for reply. It seems that my branch is already up-to-date and I couldn't merge more commits. How can I do pull/merge?
My "pr-ch32v-usbfs-host" branch's commits:
sorry, my bad, previous master isn't fix that yet. I have fixed merged and also fixed the pre-commit format as well. It is all good now.
Thank you. I found that the CI failed at macro related problem ("Build / cmake (riscv-gcc)"), so I added commits to solve it.
thank you, I am current working on other stuffs, please give me a bit of time to review this.
@hathach Thank you for sharing your status! I'm preparing to release my Suzuno32RV MCU board, which I used for testing, and I'm also working on porting Adafruit_TinyUSB_Arduino.
My fork of Adafruit_TinyUSB_Arduino: (Currently, copying ch32v20x_usb.h to arduino_core_ch32 folder is needed to build.) https://github.com/verylowfreq/Adafruit_TinyUSB_Arduino
Any chance we could get this reviewed and merged in?
this is always on my radar but still haven't manage time to review this.
Merged the latest changes in master branch.
Current problems (and I need help):
- The communication to LowSpeed device via external HUB sometimes fails. (ex: cannot get the device descriptor, tuh_mount_cb() not called)
- Plugging to the Root Port doesn't cause the problem with same device.
- In my test, USB keyboards are often causing this problem.
- Plugging the external HUB sometimes causes the resetting MCU.
Thank you for the update and patient, sorry, I am stil busy with other works. Will check this out as soon as I could.
@verylowfreq I'm glad you're working on this! If you need someone for tests, hit me up, I have a nanoCH32V203 which I can do tests with.
I just wanted to bump this because there are already two people working on host support, see also #3094.