Showing results for 
Search instead for 
Did you mean: 

STM32H7 USB Custom HID Composite Device - One Configuration, Two Interfaces

Associate III


I followed the examples in STM32CubeH7 package and implemented USB Custom HID device with 1 interface. The device is working fine. Now, I want to implement USB Custom HID Device with two interfaces. I want my device to be listed as highlighted in attached image.

I was able to go through the posts in community but I am not clear on how to add/register second interface to a Custom HID class Device.

What I understood from the post is, for the 2nd interface add the following in USBD_CUSTOM_HID_CfgDesc in usbd_customhid.c

  • Descriptors needs to be changed to indicate composite device. bNumInterfaces set to 2
  • Add Descriptor of CUSTOM HID interface
  • Add Descriptor of CUSTOM_HID
  • Add Descriptor of Custom HID endpoints


  • What should be the EPIN/EPOUT address. Shall I use 2nd endpoint?e 0x82(EPIN) and 0x02(EPOUT)
  • How to receive data from 2nd interface? CustomHID_OutEvent()
  • Should I register callback for 2nd interface in USBD_CUSTOM_HID_RegisterInterface()? If so how to handle USBD handle members classId, NumClasses?
  • What is the purpose of the macro USE_USBD_COMPOSITE in library? Should I have to define USE_USBD_COMPOSITE in my case
  • Should I have to use CompositeBuilder class. Any example on how to build.

Greatly appreciate any help on this. 



Hi, @KGane.1. I'm having the exactly same doubts you have, have you managed to accomplish any progress with this issue?


Senior III

ST have failed to provide multi-device (composite) USB for their MCUs since at least 2014, which is amazing considering that USB was introduced over 20 years ago.
There is an MX plugin that provides composite support for all the standard devices and I've just installed it in the latest CubeIDE and it looks great, however, the code isn't fully up-to-date with the latest HAL H7 structure names.

If this was updated it might provide the solution that we are all looking for.