cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement a HID composite device (Keyboard + Mouse) on STM32U5?

Seiji_Hiraki
Associate II

I would like to implement a HID composite device (e.g., mouse + keyboard) using USBX on an STM32U5.

However, calling ux_device_stack_class_register() twice (once for the mouse and once for the keyboard) returns an error. I assume this is because USBX supports only a single instance of the HID class by default.

Our existing product is recognized by the host as a composite HID device (with separate interfaces for mouse and keyboard), and I would like to replicate the same structure.

My environment:
STM32CubeIDE Version 1.17.0

STM32Cube MCU Package for STM32U5 Series 1.7.0

Board: NUCLEO-U5A5ZJ-Q
Created via:
Project Explorer -> New -> STM32 project -> Board Selector -> NUCLEO-U5A5ZJ-Q -> Finish

USBX middleware enabled

Checked all HID class options in the middleware configuration

Is there a recommended way to create a HID composite device (multiple HID interfaces) with USBX?
Should I modify the report descriptor to include multiple Report IDs, or is there a way to register multiple HID class instances?

Any advice or example projects would be greatly appreciated.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Seiji_Hiraki
Associate II

I resolved the issue myself. As stated in the URL, it was necessary to set UX_MAX_SLAVE_CLASS_DRIVER to a value greater than 0.

 

https://community.st.com/t5/stm32-mcus/how-to-implement-the-usb-device-composite-class-in-stm32-using/ta-p/645017

 

View solution in original post

1 REPLY 1
Seiji_Hiraki
Associate II

I resolved the issue myself. As stated in the URL, it was necessary to set UX_MAX_SLAVE_CLASS_DRIVER to a value greater than 0.

 

https://community.st.com/t5/stm32-mcus/how-to-implement-the-usb-device-composite-class-in-stm32-using/ta-p/645017