AnsweredAssumed Answered

STM32F4Discovery Cube-based USB Speaker application not working

Question asked by maggie.roxas on Sep 8, 2014
Latest reply on Jun 2, 2016 by zhukov.roman
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.

Outcomes