E25 — USB3 on the 12 MHz crystal (E7 pre-test)
| ID | E25 |
| Date | 2026-12-03 |
| Status | done (negative: USB3 needs the Y2 swap) |
| Decisions | D103 (DECISIONS.md) |
| Board | #1 (rev A, Y2 = 12 MHz); RP on the PC, J1 on a USB3 hub port (VIA 2109:0817, 5000M) |
| Firmware + results | fw/tests/2026-12-03-2-usb3-12mhz (main firmware with usbsspll/mco ss2, 9 USB3 test bins + their patched WCH sources, results.txt) |
| Scripts | usb3test.py, fw/usb3/build.sh |
Summary: The user asked to try USB3 anyway, in case the CH32 is more flexible than its manual. It is not: the USBSS PLL multiplies its HSE reference by a fixed 125/fref per USBSSPLL_REFSEL setting. From 12 MHz it makes 18.7–74.8 MHz, never the 125 MHz USB3 needs. Its lock flag sets anyway, and the host never sees the device.
What
- USB3 firmware sweep: WCH’s CH372Device USB3 example (vendor bulk device 1a86:5537), built for the V3F with stock
GCC (
fw/usb3/build.sh), HSE_VALUE 12 MHz, USBSSPLL_REFSEL forced to each value 0–7, lock wait bounded and printed, D7 red/blue = PLL unlocked/locked. Each binary flashed and run for 12 s while the host watches for 1a86:5537. Plus the stock 25 MHz build. - PLL output measured: main firmware
usbsspll <r>(REFSEL r, PLL on) +mco ss2(MCO 1001 = USBSS_PLL / 2, RM V1.8 RCC_CFGR0) on PB0, counted by the RP (freq 34 1000, 1 s gate).
Results
| REFSEL | nominal reference | lock | USBSS_PLL measured | 125 MHz × 12 / ref | host |
|---|---|---|---|---|---|
| 0 | 20 MHz | yes | 74.84 MHz | 75.00 | nothing |
| 1 | 24 MHz | yes | 62.36 MHz | 62.50 | nothing |
| 2 (reset) | 25 MHz | yes | 59.87 MHz | 60.00 | nothing |
| 3 | 30 MHz | yes | 49.89 MHz | 50.00 | nothing |
| 4 | 32 MHz | yes | 46.77 MHz | 46.88 | nothing |
| 5 | 40 MHz | yes | 37.42 MHz | 37.50 | nothing |
| 6 | 60 MHz | yes | 24.95 MHz | 25.00 | nothing (USB3 firmware went silent after the PLL) |
| 7 | 80 MHz | yes | 18.71 MHz | 18.75 | nothing (same) |
- The PLL locks in ~231 polls (main firmware) / ~1100 (USB3 firmware) at every setting: USBSS_PLLRDY says the loop settled, not that it runs at 125 MHz.
- Measured output = 125 MHz × 12 / ref within −0.2 % for all eight (same offset everywhere: the RP gate, not the PLL).
- No enumeration at all, not even the example’s USB2 fallback: the USBHS PLL reference (25/20/24/32 MHz) is wrong too.
- The 25 MHz build prints UART garbage (baud computed for 25 MHz) and does not enumerate either.
- The plug orientation was not swapped: with the PLL at ≤ 60 % of its rate, the SuperSpeed link cannot train in any orientation.
- Side check: the selftest SWD failures at the end of the E21–E24 run cleared after a CH32 power cycle (3/3 pass, SWIO).
Lesson
A PLL “ready” flag is no frequency check: measure it (MCO). The manual’s USBSS_PLL range is real, and the 12 MHz rev A
crystal rules out USB3 (and USBHS from HSE). Next: the Y2 → C9006 25 MHz swap, then usb3test.py check|flash|host.
Chip facts and numbers: fw/LEARNINGS.md. All experiments: index.