cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4Discovery Cube-based USB Speaker application not working

maggie
Associate III
Posted on September 08, 2014 at 08:46

I downloaded STM32CubeF4 package here, and I can't find a USB Speaker (or USB Audio Standalone) application at:

STM32Cube_FW_F4_V1.3.0\Projects\STM32F4-Discovery

So what I did was use:

STM32Cube_FW_F4_V1.3.0\Projects\STM324xG_EVAL\Applications\USB_Device\AUDIO_Standalone

... as reference, since it's meant to be tailored among STM32F407x/STM32F417x devices and it is configured to use the same CS43L22 DAC which the STM32F4Discovery uses. Basically, I want STM32F4Discovery to act as a USB Speaker when it's connected to a Host PC, by having this audio flow:

[PC] --USB Device IN--> [STM32F407x] --I2S OUT--> [CS43L22 DAC] --DAC--> earphones (via CN4)

I just did the following changes: Step 1. At General Options' Target Device in Project Options, replace:

- ST STM32F407IG
+ ST STM32F407VG

Step 2. Applied this change in main.c

- RCC_OscInit.PLL.PLLM = 25;
+ RCC_OscInit.PLL.PLLM = 8;
RCC_OscInit.PLL.PLLN = 336;
- RCC_OscInit.PLL.PLLP = 2;
+ RCC_OscInit.PLL.PLLP = RCC_PLLP_DIV2;

Step 3. At Drivers/BSP in Project Explorer, replace:

- ''STM324xG_EVAL'' drivers (stm324xg_eval.c, stm324xg_eval_audio.c)
+ ''STM32F4-Discovery'' drivers (stm32f4_discovery.c, stm32f4_discovery_audio.c)

Step 4. At C/C++ Compiler's Preprocessor in Project Options, replace:

- define of USE_STM324xG_EVAL and include directory $PROJ_DIR$\..\..\..\..\..\..\Drivers\BSP\STM324xG_EVAL
+ define of USE_STM32F4_DISCO and include directory $PROJ_DIR$\..\..\..\..\..\..\Drivers\BSP\STM32F4-Discovery

Step 5. Changed all LED references from LED 1-4 to LED 3-6 instead. Note: I retained usage of the following, since these should be the same regardless of whether STM32F4Discovery or STM324xG_EVAL board is used:
  • At Project Explorer: Application/EWARM/startup_stm32f407xx.s
  • At Project Explorer: Drivers/CMSIS/system_stm32f4xx.c
  • At Project Explorer: Application/User/usbd_conf.c (usage of PA9, PA10, PA11 and PA12 as USB pins)
However, after flashing, I don't hear any sound when I connected my earphones at STM32F4Discovery's CN4. Board was detected as ''STM32 AUDIO Streaming in FS Mode'', and all the Sound window detects music as being played via Windows Media Player (host PC's in Windows 7). The Control Panel --> Hardware and Sound --> Sound --> Speakers (right click, click ''Test'' works). The audio bar at the right part of ''Speakers'' also reacts to the sound being played (goes up and down). # With this, I assume the USB connection is fine - and problem seems to be on either the DAC or I2S. I don't see any special instructions to enable AUDIO OUT at STM32F4Discovery's CN4. I also rechecked schematics and verified that CN4's resistors, as well as AUDIO_DAC_OUT are properly mounted I also tried manually connecting the earphones at CN4's connections just to see if it's the connector's problem, to no avail. Any help will be so much appreciated. Thank you. #stm32cubef4-stm32f4discovery-usb
16 REPLIES 16
skufaev
Associate II
Posted on September 11, 2014 at 20:15

Hi,

what about USB Mic example for Disco board?

Not to store to flash, but transfer to host PC.

Posted on September 12, 2014 at 10:38

Hi kufaev.sergey,

Unfortunately no such application is available now at any STM32FW package. We’ll pass along your suggestion to our developpment team.

Thank you.

aressia
Associate II
Posted on April 13, 2015 at 17:13

Dear all, I have tried to download this MX project on my discovery board but, when I connect the board to the PC is not recognized (Unknown Device).

Do you have a recent project and/or a specific documentation how to implement Audio Class through CubeMX?

aressia
Associate II
Posted on April 14, 2015 at 14:00

Dear Maggie, could you please post the working project?

Thanks in advance

delphi
Associate II
Posted on June 02, 2016 at 11:29

Could you guys post again the modified files and project. Or maybe answer whether did the development team include the modifications to standard libarary after that?

delphi
Associate II
Posted on June 02, 2016 at 18:51

I followed these actions and now the board is not hanging. But there is no sound!

delphi
Associate II
Posted on June 02, 2016 at 18:55

I use FW 1.12