diff --git a/os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.h b/os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.h index 44a19f2ccf..8de891831f 100644 --- a/os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.h +++ b/os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.h @@ -390,7 +390,9 @@ struct USBDriver { #define usb_lld_wakeup_host(usbp) \ do { \ SN32_USB->SGCTL = (mskBUS_DRVEN|mskBUS_K_STATE); \ - osalThreadSleepMilliseconds(SN32_USB_HOST_WAKEUP_DURATION); \ + uint32_t loops = OSAL_MS2I(SN32_USB_HOST_WAKEUP_DURATION) * \ + (SN32_HCLK / CH_CFG_ST_FREQUENCY / 9); \ + for (uint32_t i = 0; i < loops; i++) __NOP(); \ SN32_USB->SGCTL &= ~mskBUS_DRVEN; \ } while (false)