diff --git a/stm32/cdcacm.c b/stm32/cdcacm.c index 03cc6e32d2..9ea0edbf11 100644 --- a/stm32/cdcacm.c +++ b/stm32/cdcacm.c @@ -47,6 +47,13 @@ #if INTERFACE_USB != 0 #define USB_CDC_REQ_GET_LINE_CODING 0x21 // Not defined in libopencm3 +#ifndef OTG_GOTGCTL_BVALOVAL +#define OTG_GOTGCTL_BVALOVAL (1 << 7) +#endif +#ifndef OTG_GOTGCTL_BVALOEN +#define OTG_GOTGCTL_BVALOEN (1 << 6) +#endif + /* * ST changed the meaning and sense of a few critical bits * in the USB IP block identified as 0x00002000 @@ -316,6 +323,9 @@ usb_cinit(void) #if defined(BOARD_USB_VBUS_SENSE_DISABLED) OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS; + + /* Force valid B-peripheral session */ + OTG_FS_GOTGCTL |= OTG_GOTGCTL_BVALOEN | OTG_GOTGCTL_BVALOVAL; #endif usbd_dev = usbd_init(&otgfs_usb_driver, &dev, &config, usb_strings, NUM_USB_STRINGS,