Question
STM32F4Discovery Cube-based USB Speaker application not working
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)
