Commit a3d87f8
committed
shared/tinyusb: Fix RHPORT mode selection for High-Speed USB.
The MICROPY_HW_TINYUSB_RHPORTx_MODE macros from mpconfigboard_common.h
are not available when tusb_config.h is compiled, because TinyUSB's
build system includes tusb_config.h before MicroPython's full
configuration chain (mpconfigport.h).
This caused CFG_TUSB_RHPORT0_MODE and CFG_TUSB_RHPORT1_MODE to be set
incorrectly for boards using High-Speed USB with external ULPI PHY,
resulting in USB descriptors with Full-Speed packet sizes (64 bytes)
instead of High-Speed packet sizes (512 bytes).
Replicate the RHPORT selection logic directly in tusb_config.h using
board configuration macros that ARE available at this compilation stage
(MICROPY_HW_USB_MAIN_DEV, MICROPY_HW_USB_HS_ULPI, STM32 family defines).
This ensures proper RHPORT configuration for all STM32 USB configurations:
- Full-Speed only: RHPORT0 enabled, RHPORT1 disabled
- High-Speed with ULPI: RHPORT0 disabled, RHPORT1 High-Speed mode
- High-Speed internal PHY: RHPORT0 disabled, RHPORT1 Full-Speed mode
Tested on STM32H747I-DISCO with USB3320 ULPI PHY.
Signed-off-by: Andrew Leech <[email protected]>1 parent 0f075b4 commit a3d87f8
File tree
1 file changed
+32
-8
lines changed1 file changed
+32
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
67 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
68 | 77 | | |
69 | | - | |
| 78 | + | |
| 79 | + | |
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
73 | 83 | | |
74 | | - | |
75 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
76 | 99 | | |
77 | | - | |
| 100 | + | |
| 101 | + | |
78 | 102 | | |
79 | 103 | | |
80 | 104 | | |
| |||
0 commit comments