cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a STM32F4 USB Composite Device (CDC+UAC) using STM32CubeMX+USB Device Middleware

jding.11
Associate II

Does the latest version of the driver of STM32F4 supporting USB audio class and CDC composite device functionality?

I want to use the USB interface of STM32F4 to develop the functions of USB audio and CDC composite devices.I have a question, is the latest version of the driver supporting USB audio and CDC composite device functionality? If supported,please let us know how to implement it.Thank you。

1 ACCEPTED SOLUTION

Accepted Solutions
Ghofrane GSOURI
ST Employee

Hello @jding.1​ 

First let me thank you for posting.

To create a USB composite device with CDC and UAC functionality, you can follow these general steps:

1- Select your target microcontroller model (e.g., STM32F479ZITx)

2- Enable the USB_OTG_FS and USB_OTG_HS by navigating to the "Connectivity" tab .


_legacyfs_online_stmicro_images_0693W00000dDTo7QAG.png
_legacyfs_online_stmicro_images_0693W00000dDTgsQAG.png3- In the "Class For FS IP" section, select "Communication Device Class (Virtual Port)" to enable CDC functionality.

In the "Class For HS IP" section, select "Audio Class" to enable UAC functionality.


_legacyfs_online_stmicro_images_0693W00000dDToRQAW.png4- Configure the other settings, such as endpoints, buffer sizes, and callbacks, as needed for your application.

5- Configure the clock settings and other peripheral configurations as per your project requirements.

6- Generate the initialization code using STM32CubeMX and export the project for your chosen toolchain (e.g., STM32CubeIDE).

Thx

Ghofrane

View solution in original post

14 REPLIES 14
Ghofrane GSOURI
ST Employee

Hello @jding.1​ 

First let me thank you for posting.

To create a USB composite device with CDC and UAC functionality, you can follow these general steps:

1- Select your target microcontroller model (e.g., STM32F479ZITx)

2- Enable the USB_OTG_FS and USB_OTG_HS by navigating to the "Connectivity" tab .


_legacyfs_online_stmicro_images_0693W00000dDTo7QAG.png
_legacyfs_online_stmicro_images_0693W00000dDTgsQAG.png3- In the "Class For FS IP" section, select "Communication Device Class (Virtual Port)" to enable CDC functionality.

In the "Class For HS IP" section, select "Audio Class" to enable UAC functionality.


_legacyfs_online_stmicro_images_0693W00000dDToRQAW.png4- Configure the other settings, such as endpoints, buffer sizes, and callbacks, as needed for your application.

5- Configure the clock settings and other peripheral configurations as per your project requirements.

6- Generate the initialization code using STM32CubeMX and export the project for your chosen toolchain (e.g., STM32CubeIDE).

Thx

Ghofrane

I would like to use the STM32F4 USB FS device as a composite device(UAC+ CDC), without using a USB HS device.please let us know how to implement it.Thank you。

I have to say that looks like a real hack, back in 2015 it was possible to set the F407 up with Audio, Virtual com port devices, and host for keyboard and mouse, as you can see in the diagram.
It looks like STM is losing the ability to support their MCUs.

Robmar_0-1695514551572.png

 

What you're asking for was available for the F407 in 2015, I have the code for doing this as you can see in this image.
STM seem to have dropped the ball on USB, it really seems like they are in a mess.  They've told me that they are focusing on USB for AzRTOS, and hope to have it working by Xmas, but like you, I'd prefer to have it working as it did back in 2015 but for the H7 in my case.

Robmar_1-1695514783176.png

 

Hi,

i totally agree. When there is a possibility to handle different devices or endpoints it should be selectable in CubeMX. At the moment I am searching for a combination of CDC (virtual com port) and UVC (webcam device). Can you upload the USB part of your project? Thx!

I use STM32F407VGT

Can you please give a link to this project? I found at least 5 composite device implementations for stm32, and none of them worked. Your example would be very helpful 🙂

MKing
Associate III

Hi,

it is a shame that CubeMX does not support a combination of several device classes. After one day of searching examples i found a "software pack" for CubeMX:

alambe94/I-CUBE-USBD-Composite: Create STM32 USB Composite devices with ease. (github.com)

ST, please support this project and promote it, so we all can save lifetime!

 

MKing_0-1705645332984.png

 

I use:

CubeMX 6.10.0

CubeIDE 1.14.0

Processor: STM32F407VGT

Isn't the I-Cube composite plug-in fantastic!  I also passed it to STM's Paris support manager, Cedric, saying this was an example of what was needed, but the response was null, not interested.

IMHO I think ST staff have been coasting for years, taking it easy, their MCU products are not developed in-house, they buy in design parts, like the USB controller, and don't really have anyone expert in how to program it.

Moreover, this package cannot be installed in the latest version of CubeIDE/cCubeMX... It looks like I will have to separately install older versions of the software and then import the project into the latest version. "Everything for users!" (sarcasm).