AnsweredAssumed Answered

STM32F4 Wave Player

Question asked by radosoft.emmil on Mar 19, 2014
Hello Forum,

I have been trying to compile the wave player example which came with STM32F4 firmware package. However due to various ifdefs in the code I had problems compiling it. There fore I write my own minimal wave player using the wave data from the example.

01.#include "stm32f4_discovery_audio_codec.h"
02. 
03.#define AUDIO_FILE_SZE          990000
04.#define AUDIO_START_ADDRESS     58
05. 
06.extern uint16_t AUDIO_SAMPLE[];
07. 
08.void EVAL_AUDIO_Error_CallBack (void *pData) {
09.        while (1);
10.}
11. 
12.void EVAL_AUDIO_TransferComplete_CallBack(uint32_t pBuffer, uint32_t Size) {
13.}
14. 
15.uint16_t EVAL_AUDIO_GetSampleCallBack(void) {
16.        return 0;
17.}
18. 
19.uint32_t Codec_TIMEOUT_UserCallback(void) {
20.        return 0;
21.}
22. 
23.void play_wave (void) {
24.        EVAL_AUDIO_SetAudioInterface (AUDIO_INTERFACE_I2S);
25. 
26.        EVAL_AUDIO_Init (OUTPUT_DEVICE_HEADPHONE, 70, I2S_AudioFreq_48k);
27. 
28.        EVAL_AUDIO_Play ((uint16_t*)AUDIO_SAMPLE + AUDIO_START_ADDRESS,\
29.                AUDIO_FILE_SZE - AUDIO_START_ADDRESS);
30.}
31. 
32.void main (void) {
33.        play_wave ();
34.        while (1);
35.}

Guess forum what ... , yes, it is not working and I have no clue why.

* Used compiler is  gcc version 4.8.1 (Sourcery CodeBench Lite 2013.11-33) 
* During debugging I get no faults, everything ends with a big OK, however without a sound
* None of the EVAL_AUDIO callbacks gets called

If anyone is willing to help me, I would be grateful. 

Outcomes