Skip to the content.

E27 — CH32 USB2 high speed on J1 (E2)

   
ID E27 (the E2 proposal)
Date 2026-12-03
Status done (480 Mb/s, bulk data clean; throughput streaming test still open)
Decisions D105, D106 (DECISIONS.md)
Board #1 (rev A, Y2 = 12 MHz); RP on the PC (J3), J1 (silk “USB3”) on the bench hub (sysfs 1-5.4.1), RP usbsel usb
Firmware + results fw/tests/2026-12-03-4-usbhs (main firmware pair, usbhs_ch372.bin + its patched WCH sources and build.sh, results.txt)
Scripts usbhstest.py, fw/usbhs/build.sh, udev rule fw/tools/60-rp417.rules

Summary: The CH32 runs USB2 high speed on J1 from the 12 MHz crystal. It enumerates at 480 Mb/s and passes 12 MiB of verified bulk loopback per run with 0 errors. The first build did not enumerate. The cause was a bug in WCH’s own clock library: RCC_USBHSPLLReferConfig() never sets the 24 MHz reference, so the PLL ran at 460.8 MHz while reporting “locked”.

What

  1. Firmware: WCH EVT USBHS/DEVICE/CH372Device (vendor bulk device 1a86:5537), V3F only, stock GCC (fw/usbhs/build.sh, as fw/usb3). Patch 5 feeds the USBHS PLL from PLLCLK / 8 = 24 MHz with REFSEL = 24 MHz (the D84 clock, proven earlier by MCO scaling only) and prints the bounded lock wait.
  2. Test: usbhstest.py sets RP usbsel usb, flashes over UART ISP, power-cycles the CH32 through the RP and logs the UART. It waits for 1a86:5537 and reads the link speed from sysfs. It then loops random data through EP1 → EP1 (as is) and EP3 → EP4, EP5 → EP6 (inverted), at 512 B–4 KiB per transfer, and checks every byte. At the end it flashes the main firmware back.

Results

run build UART host data
0a EVT RCC_USBHSPLLReferConfig(Refer_24M) (not captured) nothing —
0b PLLCFGR2 written directly (not captured) 480 Mb/s, bcdUSB 2.00 blocked: no udev permission for 1a86:5537
1 same (not captured) 480 Mb/s 0 wrong / 12 MiB
2 same rp417 USBHS_PLL LOCKED after 1170 polls (PLLCFGR2 0008072b) 480 Mb/s 0 wrong / 12 MiB

Loopback rate, Python ping-pong (one write, then one read; MB/s counted both ways), runs 1 / 2:

endpoints transfer rate
0x01 → 0x81 512 B 11.6 / 12.0 MB/s
0x03 → 0x84 (inverted) 512 B 4.2 / 3.9 MB/s
0x05 → 0x86 (inverted) 512 B 4.3 / 4.0 MB/s
0x01 → 0x81 2 KiB 15.3 / 14.4 MB/s
0x01 → 0x81 4 KiB 16.4 / 14.2 MB/s

Lesson

A vendor library is not a reference: check the bits it writes against the RM when the board differs from the vendor’s (here: a 12 MHz instead of a 25 MHz crystal). A lock flag is again no frequency check (E25). Next on USB2 HS: a streaming source/sink endpoint for one-way throughput, then port USBHS into fw/ch32 if the project needs it.

Chip facts and numbers: fw/LEARNINGS.md. All experiments: index.