cancel
Showing results for 
Search instead for 
Did you mean: 

USB Enumeration - Device demands higher power than Host can supply

krn
Associate II

Hello, 

In my application USB Device, on successful enumeration, BIT13 "USB_OTG_GINTSTS_ENUMDNE"of OTG core interrupt register (OTG_GINTSTS) turns High.

As per USB2.0, if my USB Device in its Device Descriptor demands for higher power than what external USB HOST can support, the enumeration fails.

I want to know what will be the state (high/Low) for for BIT13 "USB_OTG_GINTSTS_ENUMDNE"of OTG core interrupt register (OTG_GINTSTS) in that condition.

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hi @krn 

First, the interpretation depends on the product family in question. Messages are fully described in USB specification. The process to enumerate USB device is as follows. 

  1. The process begins with the detection of a new USB device.
  2. The host detects the connection of the USB device.
  3. Then issues a reset signal to the device.
  4. The device responds by indicating its speed.
  5. The host requests the device descriptor from the device.
  6. Then checks if the device descriptor is correct.
    • If yes, the process continues.
    • If no, the enumeration fails.
  7. Now, Host assigns a unique address to the device.
  8. Host requests the configuration descriptor from the device.
  9. Host checks if the configuration descriptor is correct.
    • If yes, the process continues.
    • If no, the enumeration fails.
  10. Finally, the host sets the device configuration. The device enters its fully operational state, and the enumeration process is successful.

Now, the implementation of ST USB library,

 

usbd_core and usbh_core files include the implementation of the core state machine process and the enumeration and the control transfers processing.

usbd_ctlreq and usbh_ctlreq files include the implementation of the processing of the control requests required for the device enumeration.

usbh_ioreq and usbd_ioreq files include the implementation of different USB transactions process.

In host mode:

FBL_0-1732211667375.png

 

In device mode:

FBL_2-1732212550234.png

USB stack ensures the correct reception and decoding of the host request and then device state modification accordingly. For further details I suggest you this interesting WIKI

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!

View solution in original post

5 REPLIES 5
FBL
ST Employee

Hi @krn 

When a USB device is connected, it initially draws a limited amount of power (up to 100 mA for USB 2.0).

During the enumeration process, the device sends its descriptors, including the Device Descriptor, which contains the bMaxPower field indicating the maximum power the device requires. The enum process wil lfail in case it cannot provide the requested power.

You may need to check or simply attach your USB traffic to analyze.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!
krn
Associate II

Thank you for your reply.

My understanding is that since enumeration fails in above case, the BIT13 "USB_OTG_GINTSTS_ENUMDNE" of OTG core interrupt register (OTG_GINTSTS) will not be set High.

Can you please comment on this ?

FBL
ST Employee

Hi @krn 

This bit reflects the enumeration is done which means simply executed not necessarily successful. Only the USB stack can interpret the enumeration if it is successful or failing.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!
krn
Associate II

Hello,

Please can you explain how does USB stack can interpret the enumeration if it is successful or failing.  

FBL
ST Employee

Hi @krn 

First, the interpretation depends on the product family in question. Messages are fully described in USB specification. The process to enumerate USB device is as follows. 

  1. The process begins with the detection of a new USB device.
  2. The host detects the connection of the USB device.
  3. Then issues a reset signal to the device.
  4. The device responds by indicating its speed.
  5. The host requests the device descriptor from the device.
  6. Then checks if the device descriptor is correct.
    • If yes, the process continues.
    • If no, the enumeration fails.
  7. Now, Host assigns a unique address to the device.
  8. Host requests the configuration descriptor from the device.
  9. Host checks if the configuration descriptor is correct.
    • If yes, the process continues.
    • If no, the enumeration fails.
  10. Finally, the host sets the device configuration. The device enters its fully operational state, and the enumeration process is successful.

Now, the implementation of ST USB library,

 

usbd_core and usbh_core files include the implementation of the core state machine process and the enumeration and the control transfers processing.

usbd_ctlreq and usbh_ctlreq files include the implementation of the processing of the control requests required for the device enumeration.

usbh_ioreq and usbd_ioreq files include the implementation of different USB transactions process.

In host mode:

FBL_0-1732211667375.png

 

In device mode:

FBL_2-1732212550234.png

USB stack ensures the correct reception and decoding of the host request and then device state modification accordingly. For further details I suggest you this interesting WIKI

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!