2014-03-19 06:08 AM
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.
#include ''stm32f4_discovery_audio_codec.h''
#define AUDIO_FILE_SZE 990000
#define AUDIO_START_ADDRESS 58
extern uint16_t AUDIO_SAMPLE[];
void EVAL_AUDIO_Error_CallBack (void *pData) {
while (1);
}
void EVAL_AUDIO_TransferComplete_CallBack(uint32_t pBuffer, uint32_t Size) {
}
uint16_t EVAL_AUDIO_GetSampleCallBack(void) {
return 0;
}
uint32_t Codec_TIMEOUT_UserCallback(void) {
return 0;
}
void play_wave (void) {
EVAL_AUDIO_SetAudioInterface (AUDIO_INTERFACE_I2S);
EVAL_AUDIO_Init (OUTPUT_DEVICE_HEADPHONE, 70, I2S_AudioFreq_48k);
EVAL_AUDIO_Play ((uint16_t*)AUDIO_SAMPLE + AUDIO_START_ADDRESS,\
AUDIO_FILE_SZE - AUDIO_START_ADDRESS);
}
void main (void) {
play_wave ();
while (1);
}
Guess forum what ... , yes, it is not working and I have no clue why.
* Used compiler isgcc version 4.8.1 (Sourcery CodeBench Lite 211-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.
#cs43l22