cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved]Unable to use Audio_in/out_init, using stm32f411e-disco & sw4stm32

simk0024
Associate II
Posted on October 09, 2015 at 15:39

Hi all,

I am newbie in stm32f411e-disco and sw4stm32.

I am trying to write a audio playback program in my board, but I met some problem in using BSP_Audio_In_Init() and BSP_Audio_Out_Init().

This is how I start my program:

1. Create new C program with project's name ''audioTest'', and choose ''Ac6 STM32 MCU GCC'' as Toolchain.

2.In MCU Configuration, ''STM32F411E-Disco'' was chosen directly.

3. In Project Firmware Configuration, ''CubeHAL'' was chosen and ''STM32_Audio'' as additional driver.

The rest remain unchanged.

In project properties,

1. I updated the Linker Script to ''STM32F411VETx_FLASH.ld'', which I get from CubeMX

2. I added '':libPDMFilter_CM4F_GCC.a'' to libraries

The rest remain unchanged

What I want it to do in my program is:

1. toggle 4 LEDs (LED3,4,5,6) until Pushbutton is press

2. Call Audio_In_Init() (or Audio_Out_Init()).

3. IF call FAIL, Led3 will on. (false case)

    ELSE both Led3 and Led4 will on. (true case)

here is my main.c:

int main(void)

{

HAL_Init();

SystemClock_Config();

BSP_LED_Init(LED3);

BSP_LED_Init(LED4);

BSP_LED_Init(LED5);

BSP_LED_Init(LED6);

BSP_PB_Init(BUTTON_KEY,BUTTON_MODE_EXTI);

while (!UserPressButton)Toggle_Leds();

if(BSP_AUDIO_IN_Init(DEFAULT_AUDIO_IN_FREQ, DEFAULT_AUDIO_IN_BIT_RESOLUTION, DEFAULT_AUDIO_IN_CHANNEL_NBR) != AUDIO_OK){

//if (BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_AUTO, DEFAULT_VOLMAX, AUDIO_FREQUENCY_16K)!= 0)

BSP_LED_On(LED3);

}

else{

BSP_LED_On(LED3);

BSP_LED_On(LED4);

}

for(;;);

}

My code was compiled and built successfully, and when I port it to my stm32f411e-disco, leds was toggling as my expectation.

However, when I press the pushbutton, the LED stop toggling, but neither true case nor false case present.

The LEDs just remain their state when I press the pushbutton.

I know program stop at calling BSP_Audio_In/Out_Init() function, but I don't know why this happen and how to fix it.

Can anyone help me and give me some advices?

Here I uploaded my full set of 'audioTest'project:

https://www.dropbox.com/sh/7fx7cu3ko5wtrn8/AACmi_OFUGxJYTuIJohumWWXa?dl=0

Thank you very much

#audio #sw4stm32 #stm32f411e-disco
1 REPLY 1
Nesrine M_O
Lead II
Posted on October 28, 2015 at 14:37

Hi sim.kae_wanq,

It will be more interesting if you let us know how you resolved the case. It may be helpful for other forum users; and this is one of forum's purposes.

-Syrine-