Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
"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 – endolith Nov 2 '11 at 14:24
@endolith, a relatively new development in my knowledge, heavily pushed for by those making smart phones. – Kortuk Nov 2 '11 at 14:29

2 Answers

up vote 3 down vote accepted

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

share|improve this answer

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.

share|improve this answer
How about with USB 1 - say I wanted to do it with a PIC18 device? – Majenko Nov 2 '11 at 15:04
@Majenko From edaboard.com/thread161532.html has same lines in same chapter – ralu Nov 2 '11 at 15:57
@Majenko: The PIC 18 USB peripheral is USB 2.0 compliant, as is every host out there less than a decade old. – Olin Lathrop Nov 2 '11 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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