Posts: 6
Registered: ‎02-24-2017

Giant Gecko and USB Composite device

I'm implementing a USB Composite device on a Giant Gecko. I need two functions: Mass storage and serial comms. (USB CDC class).


1) Am I right in saying that, even though I don't explicitly need it, I need to define a VUD in the USB config. description, something like this;


SL_ALIGN(4) const uint8_t USBDESC_configDesc[] SL_ATTRIBUTE_ALIGN(4)=
  /*** Configuration descriptor ***/
  USB_CONFIG_DESCSIZE,    /* bLength                                   */
  USB_CONFIG_DESCRIPTOR,  /* bDescriptorType                           */
  CONFIG_DESC_TOTAL_LEN,  /* wTotalLength (LSB)                        */
  CONFIG_DESC_TOTAL_LEN>>8, /* wTotalLength (MSB)                      */
  NUM_INTERFACES,         /* bNumInterfaces                            */
  1,                      /* bConfigurationValue                       */
  0,                      /* iConfiguration                            */
  CONFIG_DESC_BM_RESERVED_D7 |    /* bmAttrib: Self powered            */
  CONFIG_DESC_MAXPOWER_mA( 100 ), /* bMaxPower: 100 mA                 */

  /*** VUD (Vendor Unique Device) Function ***/
  /*** Interface descriptor ***/
  USB_INTERFACE_DESCSIZE, /* bLength               */
  USB_INTERFACE_DESCRIPTOR,/* bDescriptorType      */
  VUD_INTERFACE_NO,       /* bInterfaceNumber      */
  0,                      /* bAlternateSetting     */
  VUD_NUM_EP_USED,        /* bNumEndpoints         */
  0xFF,                   /* bInterfaceClass       */
  0,                      /* bInterfaceSubClass    */
  0,                      /* bInterfaceProtocol    */
  0,                      /* iInterface            */

  /*** MSD Function         ***/

...and the rest...

2) Am I also right in saying I need to instil two sets of drivers to handle this: the SiLabs-CDCInstaller (for the CDC, comms., USB) and the VUD driver found I the examples/usbdvud/host/libusb folder?


If find that without the VUD in the config. description part the CDC/MSD parts just don't seem to be recognised by Windows, and without the VUD driver I get a Composite device with Driver Not Found error in Device Manager.


I don't mind including the VUD part in the config. description if that is necessary, but don't like having to do two driver installs - that will only confuse people.


Is there a way of simplifying this?


Posts: 230
Registered: ‎11-17-2013

Re: Giant Gecko and USB Composite device

[ Edited ]

You don't need to define the VUD, but omitting it requires you to fix the USB descriptors - which is not a completely trivial task. Hope you have access to a linux system, since windows lacks good USB error messages in case descriptors have errors in them.


USB assigns drivers per interface. So each  (MSD, CDC, VUD) require a different driver. Windows has MSC (and CDC if >= Windows 10) build in (won't ask the user).


I recommend omitting the VUD as an exercise in USB descriptors and USB debugging. Beware: Both can be a pain in the bu...

Posts: 6
Registered: ‎02-24-2017

Re: Giant Gecko and USB Composite device

Thanks for that reply - I now have more confidence that what I want to do can be done!


I have updated the USB descriptors by removing the VUD part and then making sure that the total descriptor length is correct. Having done this, things fail to work properly.


So my next question there more to removing the VUD than this? Could my errors be caused by failing to remove the VUD part correctly (lengths are wrong?), or are there more (other) things that need to be done to the descriptors?




Posts: 230
Registered: ‎11-17-2013

Re: Giant Gecko and USB Composite device

That is excactly what happened here, too. I was just too lazy to correct those errors at this point - one yellow exclamation mark is no problem for a single internal-use-only project.


Note that there are several places that you need to correct - sizes are not enough. There is a "number of interfaces" in the configuration descriptor, for example.