Skip to main content
Visitor II
January 16, 2023
Solved

Why USB_ResetPort function has 100 ms delay ?

  • January 16, 2023
  • 1 reply
  • 1002 views

USB_ResetPort function is called in USBH_Process in HOST_IDLE state after USBH_Delay(200U); this results in 300 ms delay usb application.

Is there any way to reduce this time in stm32 USB applications.

This function is after a USB connection.

Is there any way to remove this delays in USB_ResetPort funciton.

HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx)
{
 uint32_t USBx_BASE = (uint32_t)USBx;
 
 __IO uint32_t hprt0 = 0U;
 
 hprt0 = USBx_HPRT0;
 
 hprt0 &= ~(USB_OTG_HPRT_PENA | USB_OTG_HPRT_PCDET |
 USB_OTG_HPRT_PENCHNG | USB_OTG_HPRT_POCCHNG);
 
 USBx_HPRT0 = (USB_OTG_HPRT_PRST | hprt0);
 HAL_Delay(100U); /* See Note #1 */
 USBx_HPRT0 = ((~USB_OTG_HPRT_PRST) & hprt0);
 HAL_Delay(10U);
 
 return HAL_OK;
}

 #[STM32 MCUs]​  #USB​ 

    This topic has been closed for replies.
    Best answer by MWB_CHa

    Hi @NAgha.1​ ,

    Some timings are forced by specification and by portability reasons.

    We setup these timings following validation tests ran on multiple devices.

    But if your host is going to support a specific device or specific range of devices that doesn't need this delay, then you can remove it or reduce it.

    I hope it helps.

    1 reply

    MWB_CHaAnswer
    ST Employee
    February 10, 2023

    Hi @NAgha.1​ ,

    Some timings are forced by specification and by portability reasons.

    We setup these timings following validation tests ran on multiple devices.

    But if your host is going to support a specific device or specific range of devices that doesn't need this delay, then you can remove it or reduce it.

    I hope it helps.