I am just wondering if this is possible with USB.

I am used to programming a device with USB to be a specific device type, say, a HID, or a CDC etc.

Is it possible to combine multiple device types into one USB device, so a single chip (say a PIC32) could be seen as both a HID and a CDC device at the same time, providing the functionality of both? Ideally with the two device functionalities tied to different parts of the firmware.

Is this even possible with USB, or would I need to have a small 2-port hub chip and 2 USB devices connected to that?

Or could I emulate it by having the chip seen as a hub, then connect "virtual" devices into it in software?

Has anyone tried anything like this before?

  • \$\begingroup\$ "A device that has multiple interfaces controlled independently of each other is referred to as a composite device." cygnal.org/ubb/Forum9/HTML/001050.html \$\endgroup\$
    – endolith
    Nov 2, 2011 at 14:24
  • \$\begingroup\$ @endolith, a relatively new development in my knowledge, heavily pushed for by those making smart phones. \$\endgroup\$
    – Kortuk
    Nov 2, 2011 at 14:29

2 Answers 2


Yes, you can do this with a PIC18 (full speed USB 2.0) or another PIC with USB 2.0 capability.
Microchip has a couple of examples of composite devices bundled with their stack. I would maybe have a look at one of these and adapt as necessary.

enter image description here


USB Protocol standard 2.0 chapter 9.2.3 // can be found in zip from usb.org or http://www.perisoft.net/engineer/usb_20.pdf

Within a single configuration, a device may support multiple interfaces. An interface is a related set of endpoints that present a single feature or function of the device to the host. The protocol used to communicate with this related set of endpoints and the purpose of each endpoint within the interface may be specified as part of a device class or vendor-specific definition.

I it common to have multiple interfaces in single device.

All you need to support is multiple interfaces or hub if whit "virtual devices" based on what you find simpler to implement.

  • \$\begingroup\$ How about with USB 1 - say I wanted to do it with a PIC18 device? \$\endgroup\$
    – Majenko
    Nov 2, 2011 at 15:04
  • \$\begingroup\$ @Majenko From edaboard.com/thread161532.html has same lines in same chapter \$\endgroup\$
    – ralu
    Nov 2, 2011 at 15:57
  • \$\begingroup\$ @Majenko: The PIC 18 USB peripheral is USB 2.0 compliant, as is every host out there less than a decade old. \$\endgroup\$ Nov 2, 2011 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.