summaryrefslogtreecommitdiff
path: root/ports/stm/supervisor/usb.c
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-03-26 18:16:11 -0400
committerLucian Copeland <hierophect@gmail.com>2020-03-26 18:16:11 -0400
commit348df4be2ba1bfc00a7bfab4f0de35beea78a407 (patch)
treee2c588b3abe40afc7b971f0ca7059a01bd2dac9c /ports/stm/supervisor/usb.c
parentc4db8b87e2c57ca94b8f76e4b07ca02641df714e (diff)
parentaec3b2419b2c52f6f42249207cfe2b6de5d58f61 (diff)
Merge remote-tracking branch 'upstream/master' into stm32x7-setup
Diffstat (limited to 'ports/stm/supervisor/usb.c')
-rw-r--r--ports/stm/supervisor/usb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c
index a0c907a3d..66c55d760 100644
--- a/ports/stm/supervisor/usb.c
+++ b/ports/stm/supervisor/usb.c
@@ -40,7 +40,12 @@ STATIC void init_usb_vbus_sense(void) {
#if (BOARD_NO_VBUS_SENSE)
// Disable VBUS sensing
#ifdef USB_OTG_GCCFG_VBDEN
+ // Deactivate VBUS Sensing B
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBDEN;
+
+ // B-peripheral session valid override enable
+ USB_OTG_FS->GOTGCTL |= USB_OTG_GOTGCTL_BVALOEN;
+ USB_OTG_FS->GOTGCTL |= USB_OTG_GOTGCTL_BVALOVAL;
#else
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_NOVBUSSENS;
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBUSBSEN;
@@ -83,11 +88,13 @@ void init_usb_hardware(void) {
never_reset_pin_number(0, 12);
/* Configure VBUS Pin */
+#if !(BOARD_NO_VBUS_SENSE)
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
never_reset_pin_number(0, 9);
+#endif
/* This for ID line debug */
GPIO_InitStruct.Pin = GPIO_PIN_10;