Ux_Device_HID 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 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.

At the beginning ThreadX calls the entry function tx_application_define(), at this stage, all USBx resources are initialized, the HID class driver is registered and the application creates 2 threads with the same priorities :

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
  • ThreadX usage hints

    Keywords

    RTOS, ThreadX, 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 :