Skip to main content
Tom Becker
Associate
April 14, 2017
Solved

USB Audio device on Nucleo F446-RE with CubeMX

  • April 14, 2017
  • 6 replies
  • 1530 views
Posted on April 14, 2017 at 22:44

Tried to get this working, no success.

HID is OK, virtual COM, MSD, everything works fine.

Audio class is recognized as composite device only. 

I've connected USB DP, DM and GND only. VBUS sensing is OFF.  12 MHz external HSE clock implemented, PLL for usb is generating 48 MHz correctly.

I'm on the latest cubeF4 version (1.15.0) and IAR IDE. 

Any ideas, why it's not working? 

#stm32 #cubemx-f4 #usb-audio #cubemx
This topic has been closed for replies.
Best answer by Tom Becker
Posted on April 21, 2017 at 15:06

I've found the root cause of the Problem

During USBD_AUDIO_Init the memory allocation went wrong.

/* Allocate Audio structure */

pdev->pClassData = USBD_malloc(sizeof (USBD_AUDIO_HandleTypeDef));

if(pdev->pClassData == NULL)

   {return USBD_FAIL; }

else

   {.....

It returns USBD_FAIL here and doesn't goes to the ELSE-state. We need size for 80 Packets of data (default buffer value)

After increasing __ICFEDIT_size_heap__  in the Linker File everything is fine!!!

6 replies

ST Technical Moderator
April 19, 2017
Posted on April 19, 2017 at 18:16

Hi

Becker.Tom

,

Are you using a working example from firmware package?

Try to share your main code to see if you have missed in the software ?

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Tom Becker
Associate
April 20, 2017
Posted on April 20, 2017 at 06:24

Hi Imen

unfortunately, there are no USB examples for the Nucleo-64 Boards, this board has no USB-jack ;)

I'm using CubeMX generated code as it is, no changes.

In order to get the USB working, i've set the RCC to external HSE (12MHz), set 168MHz Main CLK to get 48MHz for USB, enabled the FS-USB as device only and choose the audio-class in USB-Middle_ware. That's it.

All other Classes are  recognized by Win7 , audio-class does not.

For me, it looks like the UAC-2 is implemented, right? If yes, Win will need a driver to recognized it, as it has no UAC-2 (USB audio class-2) support onboard.

ST Technical Moderator
April 20, 2017
Posted on April 20, 2017 at 11:50

Hi

Becker.Tom

,

There is

Audio Standalone Example Code from the Cube Package for the Eval board and you can getinspired from it.

STM32Cube_FW_F4_V1.0\Projects\STM324x9I_EVAL\Applications\USB_Device\AUDIO_Standalone

Effectively,

USB Audio class 2.0 is not supported yet by our product and

USB Audio class 1 supports only low and full speed as mentioned in the section '6.4 Audio class'

of

/external-link.jspa?url=http://www.st.com/content/ccc/resource/technical/document/user_manual/cf/38/e5/b5/dd/1d/4c/09/DM00108pdf/files/DM00108pdf/jcr:content/translations/en.DM00108pdf

.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Tom Becker
Associate
April 20, 2017
Posted on April 20, 2017 at 17:43

I'm not trying to do anything, just init the audio class.

All descriptors are same, as in the example. All init functions also.

I have no idea, what is wrong.

Anybody managed usb audio to work on Nucleo64 boards? 

Tom Becker
Tom BeckerAuthorBest answer
Associate
April 21, 2017
Posted on April 21, 2017 at 15:06

I've found the root cause of the Problem

During USBD_AUDIO_Init the memory allocation went wrong.

/* Allocate Audio structure */

pdev->pClassData = USBD_malloc(sizeof (USBD_AUDIO_HandleTypeDef));

if(pdev->pClassData == NULL)

   {return USBD_FAIL; }

else

   {.....

It returns USBD_FAIL here and doesn't goes to the ELSE-state. We need size for 80 Packets of data (default buffer value)

After increasing __ICFEDIT_size_heap__  in the Linker File everything is fine!!!

victagayun
Senior III
February 14, 2021

Hi, would you share the project files w ioc file on how it was setup?