bsp/stm32f2: update vbus sense

Signed-off-by: HiFiPhile <admin@hifiphile.com>
This commit is contained in:
HiFiPhile
2026-01-30 19:24:58 +01:00
parent fd36993727
commit 1a299a0a0c

View File

@ -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
}
//--------------------------------------------------------------------+