mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
eb382989de
commit
38f4507ff0
|
@ -229,6 +229,14 @@ void USBPhyHw::init(USBPhyEvents *events)
|
||||||
hpcd.Init.use_external_vbus = DISABLE;
|
hpcd.Init.use_external_vbus = DISABLE;
|
||||||
|
|
||||||
__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
|
__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;
|
map = PinMap_USB_HS;
|
||||||
|
|
||||||
#elif (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_FS)
|
#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;
|
hpcd.Init.speed = PCD_SPEED_FULL;
|
||||||
|
|
||||||
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
|
__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;
|
map = PinMap_USB_FS;
|
||||||
|
|
||||||
#elif (MBED_CONF_TARGET_USB_SPEED == USE_USB_NO_OTG)
|
#elif (MBED_CONF_TARGET_USB_SPEED == USE_USB_NO_OTG)
|
||||||
|
|
Loading…
Reference in New Issue