Showing results for 
Search instead for 
Did you mean: 

How to create a STM32G431 USB Composite Device using STM32CubeMX+USB Device Middleware

Associate II

We are working on porting an existing STM32F373 USB application to STM32G431 using STM32CubeMX and the USB Device Middleware. The USB device is a composite device of two custom interfaces.

The first interface is a multitouch interface with 1 endpoint, the second interface is a vendor interface with 2 endpoints.

Is there any example on how to create composite USB devices with the middleware?

ST Employee

Hello @xlrl​ ,

I recommend you How to export a project configuration to a compatible STM32 FAQ.

This FAQ can help you to to migrate your current application with STM32F373 to the STM32G431.

Also, you can get inspired from the available examples in the STM32CubeH7 MCU package to create USB Composite application with STM32G431

I hope this help you!

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Thank you


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.

The existing solution quite old and not based on STM32CubeMX, but on STM32_USB-FS-Device_Driver V4.0.0. The existing code was modified in many places so the composite devices works. So the first part of the answer, exporting the configuration does not really apply her. The pin and peripherals configuration works already.

The examples you mentioned are very helpful. But there is one more issues for me her:

Our device has two HID interfaces. The first one is, depending on configuration settings a mouse or multitouch device, the second on is a vendor interfaces that is used to access metadata, firmware updates, etc.

I wonder the library has a limitation here. From what I saw when reading the source code, only one interface per class is supported.