summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2026-01-30 19:24:58 +0100
committerHiFiPhile <[email protected]>2026-01-31 00:21:23 +0100
commit1a299a0a0c694ffda39333e67a33dfebf1ca074f (patch)
tree8631294c2d5294ff56f406099ff78728edf2822d
parentfd369937279594eb8c48a81eabebb7f66bd8306a (diff)
bsp/stm32f2: update vbus sense
Signed-off-by: HiFiPhile <[email protected]>
-rw-r--r--hw/bsp/stm32f2/family.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/bsp/stm32f2/family.c b/hw/bsp/stm32f2/family.c
index 8ea8ec5a5..f863a59f0 100644
--- a/hw/bsp/stm32f2/family.c
+++ b/hw/bsp/stm32f2/family.c
@@ -31,7 +31,6 @@
#include "stm32f2xx_hal.h"
#include "bsp/board_api.h"
#include "board.h"
-
//--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler
//--------------------------------------------------------------------+
@@ -105,9 +104,14 @@ void board_init(void) {
/* Enable USB FS Clocks */
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
+#if CFG_TUD_ENABLED
// Enable VBUS sense (B device) via pin PA9
- USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_NOVBUSSENS;
- USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBUSBSEN;
+ tud_configure_dwc2_t cfg = {
+ .bm_double_buffered = 0,
+ .vbus_sensing = true
+ };
+ tud_configure(0, TUD_CFGID_DWC2, &cfg);
+#endif
}
//--------------------------------------------------------------------+