USBX Host hub class example

Mir 21 Reputation points
2022-11-15T18:45:01.58+00:00

Hello,

I would like to implement usb 2.0 hostside hub driver, and I see that there are host hub class files in usbx directory -- is there an example of how to use it? alternatively, could you please outline steps to do it? target mcu will be stm32f4

Thank you in advance!

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
329 questions
{count} votes

Accepted answer
  1. Chaoqiong Xiao 486 Reputation points Microsoft Employee
    2022-11-29T01:43:51.117+00:00

    It's easy to add hub support to any of existing USBX host example.

    1. Confirm your code is built to support more than one device (UX_MAX_DEVICES > 1) and more than one class (UX_MAX_CLASS_DRIVER > 1).
    2. Add hub class registration into your code, after host stack initialize, something like following: /* The code below is required for installing the host portion of USBX. */
      status = ux_host_stack_initialize(demo_system_host_change_function);
      if (status != UX_SUCCESS)
      return;
       #if DEMO_HUB_ENABLE  
      
           /* Register the HUB class.  */  
           status =  ux_host_stack_class_register(_ux_system_host_class_hub_name, ux_host_class_hub_entry);  
           if (status != UX_SUCCESS)  
               return;  
       #endif  
      
       #if DEMO_HID_ENABLE  
      
           /* Register hid class.  */  
           status =  ux_host_stack_class_register(_ux_system_host_class_hid_name, ux_host_class_hid_entry);  
           if (status != UX_SUCCESS)  
               return;  
      
       #endif  
      
       #if DEMO_CDC_ACM_ENABLE  
      
           /* Register CDC ACM class. (optional, ignore error)  */  
           ux_host_stack_class_register(_ux_system_host_class_cdc_acm_name, ux_host_class_cdc_acm_entry);  
       #endif  
      
       #if DEMO_STORAGE_ENABLE  
      
           /* Register storage class. (optional, ignore error)*/  
           ux_host_stack_class_register(_ux_system_host_class_storage_name, ux_host_class_storage_entry);  
       #endif  
      
    3. Compile and run, connect hub, connect device to hub port.

    Note because split transfer is not supported by controller driver right now, please connect full speed hub with full speed device or high-speed hub with high-speed device, a full speed device on high-speed hub is not supported.


0 additional answers

Sort by: Most helpful