The USB Human Interface Device (HID) class is one of the most widely-supported device classes among operating systems. Although originally developed for mice and keyboards, it has many advantages in general-purpose usage.
A common choice for general-purpose USB applications is the virtual COM port, which can be implemented using the Communications Device Class (CDC). COM ports are easy to implement on host platforms, and they are well understood by developers. A downside is that USB virtual COM port solutions for Windows machines require the end user to go through a device installation process. In addition to being a minor hassle, this process can go wrong if the user chooses the wrong options. Further, some users in corporate environments do not have administrative rights, so they are not able to do device installations without the help of a network administrator. In contrast, an HID device loads silently, bypassing all these issues.
HID does have a few disadvantages. Compared to virtual COM ports, many software engineers are unfamiliar with its use. HID relies on "reports" to carry the data, and often these complex formats provide no real value to a general-purpose application. The bandwidth on basic HID implementations is limited to 64KB/sec.
To make up for these disadvantages, TI provides a Windows HID API and demo project. It is streamlined for use with the datapipe interface that can be implemented by the MSP430 HID API stack, which eliminates the need to create HID reports. It works with composite HID devices, allowing multiple HID interfaces to easily be put in composite within the USB device, multiplying the bandwidth.
Used together, the MSP430 HID API stack and Windows HID API form an end-to-end solution that is more advantageous than virtual COM ports for many general-purpose applications.
For the USB support software for MSP430 MCUs, see the MSP430 USB Developers Package at https://www.ti.com/tool/MSP430USBDEVPACK.
This Windows MSP430 HID API is hereafter referred to as the Windows API.
Figure 3-1 shows the position of this API within a Windows software stack and in relation to the USB HID API on the MSP430 device.
The software is designed to be used with the USB HID API stack firmware for the MSP430, and specifically the datapipe interface provided by the API stack. Used together, the API stack and Windows API abstract the software developer from HID reports, allowing the developer to think of the data interface as an unformatted stream of data, similar to a COM port.
To accomplish this abstraction, the datapipe interface implements a very simple HID report structure, which the developer does not need to modify. The developer uses simple commands to send or receive data blocks of any size, and the API uses the report as a data packet to transfer this data. (See the MSP430 USB CDC/HID API Stack Programmer's Guide for more information about the datapipe interface.)