cancel
Showing results for 
Search instead for 
Did you mean: 

Is There Any Working UAC2.0 Example for STM32H7?

audio
Senior

I’m trying to build a UAC2.0 (USB Audio Class 2.0) device on STM32H7, supporting:

  • High-Speed USB
  • 24-bit audio
  • Playback + Recording
  • Full-duplex, stable, low-latency operation

After reviewing many threads here, I still haven’t found a complete or working reference.

Previous Threads Don’t Answer the Core Question

Here are some related ST Community posts with no clear resolution:

Across all of these, the same question remains unanswered:

Is there a working UAC2.0 reference for STM32H7?

 

What I Have Tried (and Why I’m Stuck)

1. X-CUBE-AUDIO-KIT

Not to be confused with X-CUBE-AUDIO (last updated 2019). Reference: X-CUBE-AUDIO-KIT

The audio kit focuses heavily on LiveTune and doesn’t explain the folder structure or how to adapt it for UAC2.0 device work. Most forum replies simply say "look at X-CUBE-AUDIO," but there is no clear documentation on how to integrate it into an actual USB audio project.

2. USBX Examples (Azure RTOS)

I looked into:

Both use UAC2.0, but neither is fully functional. There are several issues (audio distortion, buffering, pointer handling, feedback endpoint logic, etc.) that prevent reliable playback, let alone adding recording.

I also evaluated STM32WBA-BLE-USBx Standalone, but porting it to H7 requires major rewrites and may not be compatible with the existing H7 USB stack.

3. Legacy H7 USBD Audio (UAC1.0)

I considered starting from the H7 USBD Audio Standalone UAC1.0 example and updating it manually to UAC2.0, bypassing USBX entirely, but I’m unsure whether this is practical or recommended.

Moving forward...

I’m currently unable to move forward with actual development because I’m spending all my time debugging:

  • ring-buffer logic bugs

  • incorrect pointer handling

  • missing wrap-around

  • feedback endpoint issues

  • unexplained artifacts (e.g., a loud screech at 4–5 seconds)

Before I continue down another rabbit hole, I need a clear answer:

What is the correct, supported path to get UAC2.0 working on STM32H7?

 

Any guidance from ST experts would be greatly appreciated. @FBL @JonathanC 

15 REPLIES 15
JonathanC
ST Employee

Hello, 

I can answer for the X-CUBE-AUDIO-KIT part of your question, for the rest I let FBL comment.

As said in other post, ST doesn't support TinyUSB as native stack. However, I can explain the folder tree organization how it is used inside X-CUBE-AUDIO-KIT.

  • USB middleware code is inside the folder `Middlewares\Third_Party\tinyusb`
  • It is configured through a Utility SW called `UsbCls`: 
    • generic source of the wrapper inside the folder `Utilities\UsbCls`
    • Activated thanks to USBCLS_AUDIO_IN_USED and USBCLS_AUDIO_OUT_USED
    • platform dependent code under the folder Projects\STM32H...\Applications\Livetune\Platform\usbCls_Conf
  • User code that implements init according to audio-kit settings (freq, nb channels, etc... :(
    • Utilities\Audio\Src\stm32_audio_usbCls.c
    • You don't need to use Utilities\Audio SW but you can look at `stm32_audio_usbCls.c` where it calls functions prefixed by `usbCls_*`. for instance, inside `UTIL_USB_audio_setup`, `UTIL_AUDIO_USB_deinit`, `UTIL_AUDIO_USB_idle`, etc.... It will help you, see what needs to be called in your application.

 

  • This implementation runs on STM32H573I-DK, STM32H735G-DK, STM32N6570-DK and STM32H7S78-DK
  • It is UAC2.0.

 

Hope it helps,

Br

Jonathan

audio
Senior

Thank you @JonathanC 

Awaiting response from @FBL 

FBL
ST Employee

Hello @audio 

Can you explain which threads don’t answer the core Question?

For STM32H7, recording application development is ongoing and is expected in future release.

So, there will be soon new release supporting feedback endpoint. We cannot provide any details on release dates.

About the actual N6 project, now the CubeN6v1.3 supports playback + feedback.

I hope it's clear !

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.


audio
Senior

Hello @FBL 

 

This one is still unresolved: https://community.st.com/t5/stm32-mcus-embedded-software/audio-in-ux-device-audio2-0-playback-project-on-stm32h753i-eval2/m-p/861015#M70643

 

As for the projects, the folder structure is very confusing and could be organized better. For example, middleware and USBX is not organized nicely, and gets very confusing trying to find paths in the IDE project:

./Middlewares/ST/usbx
./STM32CubeIDE/Application/User/USBX
./STM32CubeIDE/Middlewares/USBX
./USBX

For this reason, I still haven't finished fixing the issues every time I build, porting H753 into the N6 project, it is a waste of time, and I still have to go through it. Your project has issues, as I mentioned in the other thread.

FBL
ST Employee

Hi @audio 

This issue was not reproduced on my end. Unfortunately, I don’t have sufficient bandwidth nor the required tools to analyze, investigate, and debug the screeching issues you mentioned.

Regarding the attached projects, please note they are not official releases. I try to provide solutions and support to help on the ST Community, but official releases might take some time to be available.

As for the project folder structure, you are free to tailor it as you see fit. However, the provided structure follows the standard organization similar to what CubeMX generates by default.

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.


Hello @FBL 

 

Are there any resources available on how to add middleware files so that I can create my own project to use H753 and still be able to port the N6 files over?

 

That's more important than anything at the moment. I still want to see the project CubeN6v1.3 on my H753. 

 

I just don't know how to deal with all the includes header as it is not easily accessible without using the includes path.

 

Thanks

Hi @audio 

Did you try generate code using latest CubeMX version?

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.


@FBL 

I did - the N6v1.3.0 Standalone version does not have the MX compatible version, so I just generate into STM32CubeIDE. From that point, I am looking into linker script to see what needs to be ported from N6 to H7. I change the startup file so that it uses H753. 

 

But the driver is different and I will also need to port that over to H753 as well. This includes Drivers/BSP, Drivers/CMSIS and Drivers/STM32N6xx_HAL_Driver, as well as some Core files that needs to be ported to H7. 

 

Once I change them, I get compilation error saying that the files do not exist, due to include path. 

 

So that's where I need guidance on, how do I do this without breaking the file structure? 

 

Hi @audio 

Maybe you need to clone git with recursive option. 

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.