This application provides an example of Azure RTOS USBX stack usage . It shows how to develop bare metal USB Host Human Interface “HID” able to enumerate and communicates with a mouse or a keyboard.
The application’s main calls the MX_USBX_Host_Init() function in order to initialize USBX and USBX_Host_Process in the while loop. As stated earlier, the present application runs in standalone mode without ThreadX, for this reason, the standalone variant of USBX is enabled by adding the following flag in ux_user.h:
The application is designed to behave as an USB HID Host, the code provides required requests to properly enumerate HID devices, HID class APIs to decode HID reports received from a mouse or a keyboard and display data on UART HyperTerminal.
When an HID device is plugged to NUCLEO-C071RB board, a message will be displayed on the UART HyperTerminal showing the Vendor ID and Product ID of the attached device. After enumeration phase, a message will indicate that the device is ready for use. The host must be able to properly decode HID reports sent by the corresponding device and display those information on the HyperTerminal.
The received HID reports are used by host to identify: - In case of a mouse - (x,y) mouse position - Wheel position - Pressed mouse buttons
Errors are detected (such as unsupported device, enumeration fail) and the corresponding message is displayed on the HyperTerminal.
User is familiar with USB 2.0 “Universal Serial BUS” specification and HID class specification.
None.
Standalone, USBXHost, USB_DRD, Full Speed, HID, Mouse, Keyboard.
In order to make the program work, you must do the following :
The user has to check the list of the COM ports in Device Manager to find out the number of the COM ports that have been assigned (by OS) to the Stlink VCP.
The application uses the HSE clock as USB source clock.