diff options
-rw-r--r-- | os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c index 3ff3bc9f0..0357d1855 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c +++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c @@ -134,7 +134,9 @@ static const stm32_otg_params_t hsparams = { static void otg_core_reset(USBDriver *usbp) {
stm32_otg_t *otgp = usbp->otg;
- osalSysPolledDelayX(32);
+ /* Wait AHB idle condition.*/
+ while ((otgp->GRSTCTL & GRSTCTL_AHBIDL) == 0)
+ ;
/* Core reset and delay of at least 3 PHY cycles.*/
otgp->GRSTCTL = GRSTCTL_CSRST;
@@ -143,7 +145,7 @@ static void otg_core_reset(USBDriver *usbp) { osalSysPolledDelayX(18);
- /* Wait AHB idle condition.*/
+ /* Wait AHB idle condition again.*/
while ((otgp->GRSTCTL & GRSTCTL_AHBIDL) == 0)
;
}
|