cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 AUDIO INTERFACE

vekariyamitul
Associate II
Posted on August 09, 2012 at 15:50

Hi,

I am trying to use beep generator function provided by CS43L22 on STM32F4 DISCOVERY.

I want to generate continuous beep and listen that on headphone, Here's the code that I've tried for that. I got no error while debugging and I've debug this code successfully on STM32F4 Discovery, still the beep wasn't generated. Even the registers on CS4L22 are successfully configured and acknowledge for the same is received. I've written function play_beep() in ''stm32f4_discovery_audio_codec.c''  Help me to find error.

Code:[Here is the portion of main() and the function that is responsible for configure CS43L22 play_beep()]

int main(void)

{

  STM_EVAL_LEDInit(LED3);

  STM_EVAL_LEDInit(LED4);

  STM_EVAL_LEDInit(LED5);

  STM_EVAL_LEDInit(LED6);

  STM_EVAL_LEDOn(LED3);

  STM_EVAL_LEDOn(LED6);

  EVAL_AUDIO_SetAudioInterface(AUDIO_INTERFACE_DAC);

  STM_EVAL_LEDOn(LED4);

  EVAL_AUDIO_Init(OUTPUT_DEVICE_HEADPHONE, 100, 18000);

  play_beep();

  STM_EVAL_LEDOn(LED5);

  while (1)

  { }

}

void play_beep(void)

{ while(Codec_WriteRegister(0x20,0x00)!=0){}

while(Codec_WriteRegister(0x21,0x00)!=0){}

while(Codec_WriteRegister(0x1A,0x00)!=0){}

while(Codec_WriteRegister(0x1B,0x00)!=0){}

while(Codec_WriteRegister(0x1C,0b11110101)!=0){}

while(Codec_WriteRegister(0x1D,0b00011110)!=0){}

while(Codec_WriteRegister(0x1E,0b10100000)!=0){}

}

Note: all the LEDs were on when I debug this code. That implies that the configuration of registers on CS43L22 were successful. Please help me to find error in this program.

#stm32f4discovery-audio
0 REPLIES 0