Skip to content

USB: Disable Vbus sensing by default #954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cores/arduino/stm32/usb/usbd_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
#else
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
#if !defined(USBD_VBUS_DETECTION_ENABLE)
#define VBUS_SENSING DISABLE
#else
#define VBUS_SENSING ENABLE
#endif

/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
Expand Down Expand Up @@ -479,14 +484,14 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
g_hpcd.Init.phy_itface = PCD_PHY_ULPI;
#endif
g_hpcd.Init.speed = PCD_SPEED_HIGH;
g_hpcd.Init.vbus_sensing_enable = ENABLE;
g_hpcd.Init.vbus_sensing_enable = VBUS_SENSING;
g_hpcd.Init.use_external_vbus = DISABLE;
#else /* USE_USB_FS */
#ifdef USB_OTG_FS
g_hpcd.Instance = USB_OTG_FS;
g_hpcd.Init.use_dedicated_ep1 = DISABLE;
g_hpcd.Init.dma_enable = DISABLE;
g_hpcd.Init.vbus_sensing_enable = DISABLE;
g_hpcd.Init.vbus_sensing_enable = VBUS_SENSING;
g_hpcd.Init.use_external_vbus = DISABLE;
#else
g_hpcd.Instance = USB;
Expand Down
5 changes: 5 additions & 0 deletions variants/board_template/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ extern "C" {
// SD Read/Write timeout, default value defined in STM32SD library
//#define SD_DATATIMEOUT x

// USB Vbus sensing. Require to have Vbus pin connected to Vbus signal.
// Warning, pin is different depending on FullSpeed or High Speed mode used
// See AN4879 https://www.st.com/content/st_com/en/search.html#q=AN4879-t=resources-page=1
//#define USBD_VBUS_DETECTION_ENABLE

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down