So, I'm building a device (it's a programmable, USB-powered RGB LED lamp, so it's rather silly :) but this problem comes up in more serious contexts as well, such as when a PLC provides a USB interface for application download to the PLC) that is going to use an application/executive model for the firmware -- the executive is programmed into Flash, implementing the USB device and core I/O functions as well as an interpreter for the application firmware, which is compiled to some sort of intermediate format before download to the device, which stores it in a separate memory space (an EEPROM or a separate Flash).

However, this raises the question of "what class should my device be?":

  • Vendor class is always an option, but it's something I'd rather not resort to unless I had to as it makes the tooling just that much more annoying without gaining me much over a "dumb pipe" solution, unless there are existing vendor class de-facto standard protocols I can follow for this?

  • You'd think DFU would make sense, but it's really designed for monolithic device firmware, not applications in an application/executive model

  • Mass Storage is not simple to implement (due to having to deal with command sets optimized for complex storage devices on the order of GB or TB, with way more going on inside them than a simple, randomly-accessible EEPROM or the likes)

  • CDC has a couple options -- CDC-ACM works everywhere, but requires a bit of extra gook to deal with the encapsulated-command business. Linux also supports CDC without a control model through the "generic" usb-serial driver, but it's not clear if Windows can be cajoled into supporting such a "skeletal" CDC implementation without having to write code. (I can sacrifice Windows support in this application, but it'd be a nice-to-have even if it's at a "should work" state.)

  • HID also provides a couple options: one can implement a "dumb pipe" over HID if CDC isn't an option for some reason, or it's possible to do more sophisticated protocols via HID as well. This has the advantage that both Windows and Linux deal well with talking to HID devices from userland, but has downsides as well, since this isn't what HID was intended to do.

  • Media Transfer Protocol provides a Mass Storage alternative that works more along the lines of a filesystem (and is thus simpler in some ways) but has the downside that it is not supported very cleanly on Windows (Explorer handles it OK, but it is not handled cleanly from a scripting/command line standpoint at all). Linux tends to be a bit picky about MTP devices as well...

Anyone out there know what's been done before in this type of application?

  • 1
    \$\begingroup\$ Isn't it ironic how 20+ years into USB, there is literally nothing that works painlessly on all platforms? For moderately technical users, a custom solution handled in userspace may be the least painful in that the setup steps are fairly consistent, vs trying to use something "supported" may at times be setup-free but also runs a greater risk of hitting operating system quirks and terrible design assumptions that may vary between versions and installs. \$\endgroup\$ Nov 26, 2017 at 19:29
  • \$\begingroup\$ Note that you can have multiple endpoints of different classes, which might make more sense than changing class. \$\endgroup\$
    – pjc50
    Nov 26, 2017 at 21:09
  • \$\begingroup\$ @pjc50 yes, though there can be issues with OS drivers grabbing what they recognize and not wanting to let you have access to the rest without complicated driver removal/blacklisting. \$\endgroup\$ Nov 26, 2017 at 21:57
  • \$\begingroup\$ @pjc50 -- whether to go mono-class or multi-class is a whole another can of worms (there's something to be said for having a CDC or HID "dumb pipe" for debug purposes if there isn't already one in the design...) \$\endgroup\$ Nov 26, 2017 at 23:21

1 Answer 1


A device that upon reset starts as DFU, then after while it disconnects and connects back again as VCP. Or you could make a your command that brings the device from VCP to DFU mode.

Such device exists, an Arduino clone on STM32. link: https://github.com/rogerclarkmelbourne/Arduino_STM32

  • \$\begingroup\$ Yes, this is certainly an approach in use, though VCP requires at least an identity-level driver on Windows, and on Linux typically requires a one-time configuration of user permissions to serial devices in general, but may also suffer interference from the infamous brltty driver or modem manager, etc. \$\endgroup\$ Nov 26, 2017 at 22:00

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.