E9 — CH32 USB full-speed device on J2
| ID | E9 |
| Date | 2026-12-02 |
| Status | done |
| Decisions | D85 (DECISIONS.md) |
| Board | #1 (rev A, 12 MHz crystals) |
| Firmware + results | fw/tests/2026-12-02-7-usbfs (sources, binaries, results.txt) |
| Scripts | usbfs.py |
Summary: ch32fun fsusb ported to the H41x: CDC device enumerates first try; IN 525 kB/s, OUT ≤ 390 kB/s, 0 errors.
What
USBFS (PA11/PA12, J2) as a CDC ACM test device (1209:d035) in the main firmware; bulk throughput both ways.
Results
- Enumerates ≈ 1 s after
usbfs on, 12 Mbps. - Bulk IN 525–530 kB/s, OUT 290–390 kB/s, 0 sequence errors; identical at HCLK 48 and 96 MHz (not CPU-bound; board behind a dock hub).
- The H41x USBFS block has the CH32L103 register layout; USBFS 48 MHz = USBHS PLL / 10.
Update (E14, D90): the IN limit was not the hub: the USB interrupt ran from flash, where the V3F is ≈ 15× slower. With the handler in RAM: IN 880 kB/s, OUT 775 kB/s on the same hub path. See E14. On a direct port (E15): OUT 1020 kB/s; IN is set by the host (≈ 75 µs per packet). See E15.
Lesson
Before porting a USB stack, diff the register struct against families the library already supports.
Chip facts and numbers: fw/LEARNINGS.md. All experiments: index.