Hi Greg and all, Generally enumeration sequence of USB (from host perspective) is - start with address 0, (i) Get the device descriptor (DD) (ii) note the control endpoint (EP0) size of device (iii) configure the EP0 of host to EP0 of device (iv) Get the complete 18 bytes of DD (v) Reset the device (vi) Send setup packet on address 0 with new address (vii) Then read all the descriptors with newly assigned address.
Currently while developing the USB host driver, I am able to get till point (iv). This is completely done by usbhost_enumerate() function [in usbhost_enumerate.c] - This calls first DRVR_EP0CONFIGURE() to set the default EP0 size as 8 bytes (of host's EP0). Then gets the 8 bytes of DD with DRVR_CTRLIN - for step (i) and (ii) above. Next usbhost_enumerate() calls DRVR_EP0CONFIGURE() with new size. Then gets the all the 18 bytes of DD with DRVR_CTRLIN(). Finds out internally about new address to be assigned and calls DRVER_CTRLOUT () to set the new address - still with address 0. Next DRVR_EP0CONFIGURE() is called with new address - to set the new address in the host driver. Finally calls DRVR_CTRLIN() to get the config descriptors with new address. I am not very sure, if this sequence is correct. If any of you have worked on USB Host driver, please let me know 1. My understanding is "usbhost_enumerate.c" is hardware agnostic module and should not be modified to port USB host for different controllers. Is this correct? 2. In the above sequece - I see missing Reset (point v as in above). It should be supposed to be called from usbhost_enumerate() [in usbhost_enumerate.c]. Is this my understanding correct? Or am I missing something? Or this should be done by usb host driver itself?- so usb host driver resets the device once it deciphers the standard set_address command? 3. Also for setting the new address (for point vi), usbhost_enumerate() [in usbhost_enumerate.c] is calling DRVR_CTRLOUT. I think, this should be DRVR_CTRLIN, as host issues the address as setup packet and expects 0 bytes data as acknowledgement on control In pipe. 4. In that way, can each controller port for USB host can have its own version of usbhost_enumerate.c? Any of your thoughts/ comments/ suggestions would help me. With best regards, Phani.