Skip to main content
Robmar
Senior II
March 10, 2023
Question

The standard STM32F407 USB audio driver only supports 48k, is there any info available to up it to higher speed?

The standard STM32F407 USB audio driver only supports 48k, is there any info available to up it to higher speed?

This topic has been closed for replies.

20 replies

mohamed.ayed
ST Employee
March 10, 2023

Hi @Robmar​ 

Our legacy ST-USB lib support only audio 1.0 it support only FS speed but for HS you need to switch to USB Audio 2.0 you can use AzureRTOS middleware stack it support both Audio1.0 and Audio 2.0.

Robmar
RobmarAuthor
Senior II
April 20, 2023

Not sure the rtos overhead or memory requirements would fit unfortunately ​

Robmar
RobmarAuthor
Senior II
March 10, 2023

Thank you Mohamed, appreciated. Do you know if I can use the middleware stack without having to use the RTOS itself, it's a little short on memory as it is. It doesn't look like it's going to fit:

This I guess:- "Azure RTOS USBX is a high-performance USB host, device, and on-the-go (OTG) embedded stack. Azure RTOS USBX is fully integrated with Azure RTOS ThreadX and available for all Azure RTOS ThreadX–supported processors."

mohamed.ayed
ST Employee
March 10, 2023

@Robmar​  AzureRTOS stack support both RTOS (with threadx) & Standalone mode you need juste to update you middleware 6.2.0 and then define UX_STANDALONE in ux_user.h

you can see HID Stanndalone application:

https://github.com/STMicroelectronics/x-cube-azrtos-h7/tree/main/Projects/NUCLEO-H723ZG/Applications/USBX/Ux_Device_HID_Standalone

we have a draft ux_device_audio application here :

https://github.com/STMicroelectronics/x-cube-azrtos-h7/tree/dev/usbx/Projects/STM32H743I-EVAL/Applications/USBX/Ux_Device_Audio

Robmar
RobmarAuthor
Senior II
March 16, 2023

Do you think I could set higher board rates in usbd_conf.h ?

#define USBD_AUDIO_FREQ   48000

Robmar
RobmarAuthor
Senior II
March 10, 2023

Thanks, very useful. The draft example you reference is for the H7, is there any way to change that easily to F407? Came across this before, a sample for an F411, IDE refuses to change the MCU type, so I had to hack the .cd and other files replaces all the MCU references, took me nearly an hour, but quicker than recreating the project.

Robmar
RobmarAuthor
Senior II
March 15, 2023

Not much of a description on that site, any idea what it does?

AScha.3
Super User
March 16, 2023

see in main.c :

0693W00000aJ8xcQAC.png

If you feel a post has answered your question, please click on " Best Answer ".
Robmar
RobmarAuthor
Senior II
March 15, 2023

I've been told that the standard USB audio driver on the STM32F407 can handle higher rates just by changing the descriptor. Anyone any idea on that?

LCE
Principal III
March 16, 2023

In case you have a dev board: try it! Worst case you get some blue screens... :D

If you don't have a dev board, get one.

If I'm in doubt about an STM32's capabilities, I definitely try to make it work on a Nucleo board or so before putting it on a custom PCB.

Robmar
RobmarAuthor
Senior II
March 16, 2023

haha sure, but I could not see in the descriptors where the baud rate is defined, there was no obvious define for 48000...!

It's just a long list of stuff with not much commenting!

Piranha
Principal III
March 17, 2023

> Not much of a description on that site

https://docs.tinyusb.org/en/latest/reference/getting_started.html

Together with the examples... enough for me.

> any idea what it does?

Isn't it obvious even by the folder name?

> Could it be as easy as just changing that to 96000, or 192000?

https://github.com/STMicroelectronics/STM32CubeF4/blob/e92669fc501fb8b7512fd6890a6eb379b6ae90c5/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Src/usbd_audio.c#L38

> Could it be made selectable at boot time by replacing with a variable?

Other people have already implemented that and more necessary features. That's why, instead of messing with a broken bloatware, they developed an actually usable USB stack, like TinyUSB.

> Worst case you get some blue screens

An externally connectable device cannot make BSOD. If it can, that's a bug in the host OS or drivers.

LCE
Principal III
March 17, 2023

>> Worst case you get some blue screens

> An externally connectable device cannot make BSOD. If it can, that's a bug in the host OS or drivers.

Well, that's my USB experience from about 15 years ago when working with Cypress FX2 and the Cypress driver and Windows x (was that still XP?).

At that time, one error in the descriptors and Windows was very blue...

Piranha
Principal III
March 22, 2023

It's definitely a bug in some component. Most likely in the Cypress driver, less likely in a Windows integrated drivers or USB stack.