Ux_Device_HID_Standalone Application Description

This application provides an example of Azure RTOS USBX stack usage on NUCLEO-C071RB board, it shows how to develop USB Device Human Interface “HID” mouse based bare metal application.

The application is designed to emulate an USB HID mouse device, the code provides all required device descriptors framework and associated class descriptor report to build a compliant USB HID mouse device.

The application’s main calls the MX_USBX_Device_Init() function in order to Initialize USBX and USBX_Device_Process in the while loop.

As stated earlier, the present application runs in standalone mode without RTOS, for this reason, the standalone variant of USBX is enabled by adding the following flag in ux_user.h:

To customize the HID application by sending the mouse position step by step every 10ms. For each 10ms, the application calls the GetPointerData() API to update the mouse position (x, y) and send the report buffer through the ux_device_class_hid_event_set() API.

Expected success behavior

When plugged to PC host, the NUCLEO-C071RB must be properly enumerated as an USB HID mouse device. During the enumeration phase, device provides host with the requested descriptors (Device, configuration, string). Those descriptors are used by host driver to identify the device capabilities. Once the NUCLEO-C071RB USB device successfully completed the enumeration phase, the device sends a HID report after a user button press. Each report sent should move the mouse cursor by one step on host side.

Error behaviors

Host PC shows that USB device does not operate as designed (Mouse enumeration failed, the mouse pointer doesn’t move).

Assumptions if any

User is familiar with USB 2.0 “Universal Serial BUS” Specification and HID class Specification.

Known limitations

The remote wakeup feature is not yet implemented (used to bring the USB suspended bus back to the active condition).

Notes

None.

Keywords

STANDALONE, USBXDevice, USB_DRD, Full Speed, HID, Mouse

Hardware and Software environment

How to use it ?

In order to make the program work, you must do the following :