Author Topic: Allowable USB enumeration time for timeout?  (Read 4698 times)

anotherstevest

  • Member
  • ***
  • Posts: 10
Allowable USB enumeration time for timeout?
« on: April 21, 2021, 05:30:52 pm »
Greetings Jan and fellow devs,

I've got a very low power device that sometimes (mostly for debug), will be connected to a host via USB.  If, after reset or other wake event, the device hasn't successfully been enumerated by some host, it needs to shut down usb and go back to sleep.  If it has successfully enumerated, it needs to stay awake till USB is disconnected.  The challenge is that enumeration times are all over the map (with windows, anyway).  What used to be plenty is no longer long enough and I could use some guidance as to what is "long enough" so that if it's going to enumerate, it will have...  without making longer than it should be.

Is there any standard expectation for acceptable enumeration time?

Best regards,

Steve.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Allowable USB enumeration time for timeout?
« Reply #1 on: April 22, 2021, 09:00:15 am »
The device has this responsibility:

On attaching to a port, the device connects to the bus by bringing the appropriate pull-up line high so the hub can detect that a device is attached. Except for some devices with weak or dead batteries, the device must connect within 1 s after detecting that VBUS is at least 0.8 V.

I'm not aware of any timing constraints for when the host needs to begin enumerating after the hub detects the connection. Anything longer than a few seconds would affect the user experience, however, and thus I hope would be avoided.

Bret

  • Frequent Contributor
  • ****
  • Posts: 68
Re: Allowable USB enumeration time for timeout?
« Reply #2 on: April 22, 2021, 12:12:48 pm »
At least when it comes to Windows, I've learned to avoid the use of timing to automate anything (at least anything that matters).  How long things can take to happen are so unpredictable that it's almost guaranteed that at some point "long enough" will no longer work.  If it's possible, you need to try and figure out some parameter to monitor other than time.

anotherstevest

  • Member
  • ***
  • Posts: 10
Re: Allowable USB enumeration time for timeout?
« Reply #3 on: April 22, 2021, 01:59:14 pm »
Oh well, this is a case wherein the answer I expected (and got) wasn't the one I was hoping for but it was worth checking.  Thanks Jan and Bret.  Steve.