Electronic – One USB device with multiple device types

picusb

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?

Best Answer

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