diff --git a/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/inc/usbconfig.h b/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/inc/usbconfig.h index 9e26d012b1f..48db0b85e0c 100644 --- a/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/inc/usbconfig.h +++ b/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/inc/usbconfig.h @@ -49,6 +49,10 @@ extern "C" { USB_PWRSAVE_MODE_ENTEREM2 Enter EM2 when USB peripheral is in low power mode. On Mbed this allows the sleep() and deepsleep() calls to enter EM2, but does not automatically enter any sleep states. Entering EM1 is always allowed. + + Note for Happy Gecko, errata USB_E111: Entering EM2 when both the system clock + (HFCLK) and the USB core clock (USBCCLK) is running on USHFRCO will result in + a lock-up. */ #define USB_PWRSAVE_MODE (USB_PWRSAVE_MODE_ONSUSPEND|USB_PWRSAVE_MODE_ONVBUSOFF|USB_PWRSAVE_MODE_ENTEREM2) diff --git a/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/src/em_usbd.c b/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/src/em_usbd.c index 0a24f7e82cf..17aa0c3a2e4 100644 --- a/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/src/em_usbd.c +++ b/libraries/USBDevice/USBDevice/TARGET_Silicon_Labs/src/em_usbd.c @@ -891,6 +891,14 @@ int USBD_AddEndpoint(int epAddr, int transferType, totalTxFifoSize, totalRxFifoSize); INT_Disable(); +#if defined( CMU_OSCENCMD_USHFRCOEN ) + /* Happy Gecko workaround: disable LEM GATE mode if using ISOC endpoints. */ + if ( transferType == USB_EPTYPE_ISOC ) + { + USB->CTRL = (USB->CTRL & ~_USB_CTRL_LEMOSCCTRL_MASK) | USB_CTRL_LEMOSCCTRL_NONE; + } +#endif + int ret = USBDHAL_ReconfigureFifos(totalRxFifoSize, totalTxFifoSize); INT_Enable();