AnsweredAssumed Answered

How to make USB Audio Speaker work in STM32F303C-EVAL?

Question asked by maggie.roxas on Jul 30, 2014
Hi,

Firstly, I tried to browse on the forums but there were only a few concerning STM32 F3-series.

I have an STM32303C-EVAL board with STM32F303VCT6 MCU.
I wanted it to act as a USB Audio Speaker.
Basically:

[PC] --USB--> [MCU] --I2S--> [CODEC] --> HEADPHONES

I used STM32CubeMX (v4.3) to generate the default IAR firmware using STM32303C-EVAL board configuration (added USB Device library acting as Audio Class Device).

I then copied STM32CubeF3's example for STM32303C-EVAL, "I2S_Audio", which uses the same base code as STM32CubeMX:
http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF260613

I tried to manually add I2C2 and SPI2 (I2S2) config via adding the following files:
       
  • Drivers/BSP/Components/cs42l52.c
  •    
  • Drivers/BSP/STM32303C_EVAL/stm32303c_eval.c
  •    
  • Drivers/BSP/STM32303C_EVAL/stm32303c_eval_audio.c
I also modified configurations (include path) and added references to above’s header files for it to build successfully.
Then I modified main.c to include call to BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_AUTO, 70, I2S_AUDIOFREQ_8K).
Lastly, I added DMA2_Channel2_IRQHandler() in stm32f3xx_it.c/h.
# I copied from STM32CubeF3’s I2S_Audio example.

The USB is detected as “STM32 Audio Class” (as seen in Devices and Printers, Control Panel's Hardware and Sound), however, I can’t play any sound in host PC.

Am I supposed to fill-up BSP_AUDIO_OUT_TransferComplete_Callback() and call BSP_AUDIO_OUT_Play(hAudioOutI2s.pTxBuffPtr, hAudioOutI2s.TxXferSize) on it?

Or are there any other possible fix for this?
The "[PC] --USB--> [MCU]" seem OK already.
My problem seems to be the "[MCU] --I2S--> [CODEC] --> HEADPHONES".
# Failed to play test tone in PC's Speaker test (I'm using a Windows 7 PC).

Please help.

Regards,
Maj

Outcomes