USB HID Composite Device
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-21 6:58 AM
I am currently working on a project where I'm designing a keypad to send HID commands over USB. Now, I want the keys to register as if a keyboard was connected and a a rotary encoder to control mouse scroll wheel operations. To confirm, is this possible with a composite class such that it enumerates as a keyboard+mouse? Also, if anyone has experience with HID, is it possible to send power commands from the STM to the computer if a key is pressed?
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-22 7:41 AM
Hi @mahirmahota
Indeed you can implement Dual HID using ST library. Check this article.
Some community articles may help as well :
- How to implement the USB device composite class (DFU + HID) article and its associated project
- How to implement USB device composite class in STM32H5 microcontrollers (HID + CDC) tutorial and project
- How to implement USB device composite class DUAL CDC article
- For STM32H7 boards, you can download this branch of firmware for composite examples
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-21 7:21 AM
Hello @mahirmahota
I reported your question internally.
Internal ticket number: 210439 (This is an internal tracking number and is not accessible or usable by customers).
Saket_Om
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-22 7:20 AM
Hello @mahirmahota
If you are working on STM32F4 with classic library, you might find this example useful. Alternatively, if you are using USBX stack, you can start with this example.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-22 7:37 AM
Hi,
Thank you, those samples help a lot! The USBX example is exactly what I was looking for and I might try to emulate that with FreeRTOS. Is a similar solution possible without threads using the classic library or does a composite HID device have to be multithreaded?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-22 7:41 AM
Hi @mahirmahota
Indeed you can implement Dual HID using ST library. Check this article.
Some community articles may help as well :
- How to implement the USB device composite class (DFU + HID) article and its associated project
- How to implement USB device composite class in STM32H5 microcontrollers (HID + CDC) tutorial and project
- How to implement USB device composite class DUAL CDC article
- For STM32H7 boards, you can download this branch of firmware for composite examples
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-22 7:51 AM
Hi,
Perfect, that makes sense then. Is it possible to apply as many classes as I want in a composite (say, dual HID + DFU + CDC) or is it limited in any way? I'd think that's possible but in case I'm missing something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-22 9:25 AM
Hi again @mahirmahota
This question should be asked in a separate thread!
Each USB interface requires a certain number of endpoints. The total number of endpoints available is determined by the USB controller in your STM32. If your device has enough endpoints to accommodate all the interfaces you want to implement, then it is feasible.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
