cancel
Showing results for 
Search instead for 
Did you mean: 

Freertos audio task freeze

felix giffuni
Associate
Posted on January 16, 2017 at 10:17

Hello,

I have added an audio  task to the stm32f746g discovery project netconn udp echo server (Freertos + lwip ).

The audio task is very simple.I capture the audio data from the microphone and i play it back.

The audio code works in stand alone mode (without using freertos)  but when i use freertos the audio task and the ethernet tasks freeze .The audio is correctly processed ( audio in from microphone is played out without problem ) but the LED1 stop to toggle ( LED1 toggle in audio task ) and all ethernet tasks don't work anymore.

Here is my code of the audio task :

static void my_audio_thread(void *arg)

{

audioBuffer = (uint16_t *)malloc(MIC_SAMPLES * 2);

/* Init OnboardMIC */

BSP_AUDIO_IN_OUT_Init(INPUT_DEVICE_DIGITAL_MICROPHONE_2, OUTPUT_DEVICE_HEADPHONE, 100, DEFAULT_AUDIO_IN_FREQ);

BSP_AUDIO_IN_Record(audioBuffer, MIC_SAMPLES*2);

/* Update the Audio frame slot configuration to match the PCM standard instead of TDM */

BSP_AUDIO_OUT_SetAudioFrameSlot(CODEC_AUDIOFRAME_SLOT_02);

/* ATT: size to play in bytes ! */

BSP_AUDIO_OUT_Play(audioBuffer, MIC_SAMPLES*2 * sizeof(uint16_t));

   for(;;)

   {

      BSP_LED_Toggle(LED1);

      vTaskDelay( 500 );

   }

}

if i remove the line BSP_AUDIO_OUT_Play(audioBuffer, MIC_SAMPLES*2 * sizeof(uint16_t));

the others tasks are not stopped and LED1 toggle.

 If someone could help me to find out the way to resolve this issue it would be great!!!

Thank you.

Félix.

0 REPLIES 0