Skip to content

STM32 H7: fix USB in sleep mode #13780

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 1 commit into from
Nov 26, 2020
Merged
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
16 changes: 16 additions & 0 deletions targets/TARGET_STM/USBPhy_STM32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ void USBPhyHw::init(USBPhyEvents *events)
hpcd.Init.use_external_vbus = DISABLE;

__HAL_RCC_USB_OTG_HS_CLK_ENABLE();

#ifdef __HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE
__HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
#endif
#ifdef __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE
__HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
#endif

map = PinMap_USB_HS;

#elif (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_FS)
Expand All @@ -238,6 +246,14 @@ void USBPhyHw::init(USBPhyEvents *events)
hpcd.Init.speed = PCD_SPEED_FULL;

__HAL_RCC_USB_OTG_FS_CLK_ENABLE();

#ifdef __HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE
__HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
#endif
#ifdef __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE
__HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
#endif

map = PinMap_USB_FS;

#elif (MBED_CONF_TARGET_USB_SPEED == USE_USB_NO_OTG)
Expand Down