]> USB 2.0 HID 1.11 device running on a SiLabs C8051F342 or a C8051F346 microcontroller unit

USB 2.0 HID 1.11 running on a SiLabs C8051F342 or a C8051F346 microcontroller unit

by Stephan K.H. Seidl

Version 1, Mon, 13 Jan 2020 21:16:08 +0100


Nowadays, USB HIDs are widely used to connect hotplug devices to a computer without the need to provide a device driver. In order not to be rejected, such a device meticulously answers all requests from the host, but formulates the descriptors so that the host cannot determine what the device is intended for. The device is available in that way, but cannot be accessed by the operating system. It is therefore immediately available in the user space if the application in question has the necessary rights. It is further of secondary importance whether the user space application then uses the standard HID interfaces or proprietary vendor USB interfaces for the actual work.

Regardless, creating a properly functioning USB HID is not that easy. It is therefore sensible to publish the code of a standard-compliant and quite complex device one time in order to give beginners or interested parties a reasonable start.

To do

Writing to the flash program memory has not yet been tested, but will be done one day.

Change log

For the change log click Changelog.
Comments, bug reports, and better ideas are welcome.


The file mainusb.c (click here for download) contains the source code of a particular USB HID. The present code controls the bare silicon without any library. What is still missing is the small startup file, which cannot be displayed here for licensing reasons. Startup files can typically be found in the development system used. The following photo shows a candidate for the underlying hardware as offered by Crossware in the past.


That's it.

Mon, 13 Jan 2020 21:16:08 +0100

Stephan K.H. Seidl