Author Topic: USB device multiple configurations  (Read 10244 times)

chandu

  • Member
  • ***
  • Posts: 5
USB device multiple configurations
« on: September 11, 2014, 02:47:54 am »
Hi every one,

Here my doubt is i want to set my device with multiple configurations, one as VCP port and another one is normal data logger. when i switched to control request my device default state is VCP configuration after completion of enumeration i want to transfer some data to the my device.

then I want to change the configuration of the my device to another type for specific application, how to change the configuration of my device and how to switch my previous configuration when i need that one.

my doubt is it possible to change the configuration of the device one type to another type, in control transfer host asks for a configuration descriptor i have two configurations which configuration it select and what basis it select the particular configuration.

I have too many doubts about multiple configurations for a single device, please can any one help me.

Thanks & Regards,
Chandu.Kurapati.

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: USB device multiple configurations
« Reply #1 on: September 11, 2014, 02:03:57 pm »
First question is which host are you using?

If you're using a Windows host, this is difficult and requires you to have your own driver. That's something I can't help you with, when I did this for a previous product, someone else wrote the Windows driver. On a Mac this is pretty trivial. Once you have your own driver, it seems to be pretty trivial even on Windows. One of the products I worked on now has 4 configurations.

I'm not sure what your actual question is. To switch configuration you need to arrange for the host to send a Set_Configuration setup command. How to do that is OS dependent, the OS may not allow you to just send such a command to the device, it may recognize such an attempt and reject it. If you do send such a command, it may confuse the OS as the device is now not in the state its expecting.

Does your device actually need two configurations? Can you use a composite device with two interfaces both of which can be active at the same time? This is a much simpler way of going about it and just works on every OS I'm aware of.


chandu

  • Member
  • ***
  • Posts: 5
Re: USB device multiple configurations
« Reply #2 on: September 12, 2014, 12:17:27 am »
Hi Barry Twycross,

I am using AVR micro controller as my device and PC as a host, what you did mentioned in that post about set configuration command i understand that concept and i have no idea about it how to solve the problem.

 according to  documents i understand that only one configuration is possible for a device at a time, you mentioned about composite device what is that, is it possible to enable the more than one configuration using composite device.

My device AVR controller can support for this, can you please explain about this conflict.

Thanks & Regards,
Chandu.Kurapati.

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: USB device multiple configurations
« Reply #3 on: September 12, 2014, 04:15:46 pm »
By PC I assume you mean a Wndows PC. The PC's OS is the important thing.

Configurations are mutually exclusive, the device can only be in one at once. It is vey rare to find a device with multiple configurations, I only know of one company which has bothered to make it work (the one I used to work for). The big problem with configurations is Windows only supports one configuration by default. To enable multiple configurations for your device you need to write a custom device driver, which most people don't have the ability to do (including you and me it seems.)

Interfaces are not mutually exclusive, they work at the same time as each other. A device where its functionality is determined by its interfaces is called a composite device. Most devices in the world are composite devices, though they usually only have one interface, and thus one function. However multiple (concurrent) interfaces are supported on all major OSs. So there are a large selection of devices in the world which have multiple interfaces. Each interface enumerates as its own function, largely independent of the other interfaces in the device.

You have two interfaces, VCP and Log. With configurations it would look like this:

Configuration 1:
  VCP
Configuration 2:
  Log

You can have one or the other, you have to arrange to send a set configuration to switch between the two device modes.

With interfaces it'd look like this:

Configuration 1:
  VCP (interface 1)
  Log (interface 2)

The OS will enumerate the VCP port as a standard device, it'll let whatever driver you use for the log to attach to the other. Both can work at the same time. My current device can look exactly like that, and both the VCP and log interfaces work independently at the same time.