Commit 27b7bf3
stm32/usb: Add VBUS sensing configuration for TinyUSB on F4/F7.
TinyUSB's `dwc2_phy_init()` only sets the PWRDWN bit in the GCCFG register
but doesn't configure VBUS sensing, which is required for the DWC2 USB
controller to detect host connection on STM32F4 and STM32F7 series.
Without VBUS sensing configured, USB devices fail to enumerate on these
platforms when using the TinyUSB stack, while the legacy STM32 USB stack
works because it includes this configuration.
This commit adds VBUS sensing configuration in `pyb_usbd_init()` for
TinyUSB mode on STM32F4/F7:
- When VBUS detect pin is configured (typically PA9): Enable "B device"
VBUS sensing (USB_OTG_GCCFG_VBUSBSEN)
- When no VBUS pin: Force VBUS valid (USB_OTG_GCCFG_NOVBUSSENS)
Tested on:
- NUCLEO-F429ZI: USB now enumerates successfully (CDC + MSC)
- NUCLEO-H563ZI: No regression (STM32H5 uses different register layout)
Signed-off-by: Andrew Leech <[email protected]>1 parent faae8e7 commit 27b7bf3
1 file changed
+16
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
180 | 196 | | |
181 | 197 | | |
182 | 198 | | |
| |||
0 commit comments