fix USB in sleep mode

in sleep mode, USB interrupts were disabled
and USB Device was not working. Sleep mode is default in Mbed-os
e.g. in a call to sleep_for()
pull/13780/head
JojoS62 2020-10-17 00:50:40 +02:00
parent eb382989de
commit 38f4507ff0
1 changed files with 16 additions and 0 deletions

View File

@ -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)
@ -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)