Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


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

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(;;);
}

  • I attached screen shot of my project main function (audioTest.png)


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=0Question

Thank you very much

I remember that for one project I have seen some errors (not at building phase) when I open some .c source files. Anyway, I close that source files and then I deleted the errors and then there was no build error.

I don’t know if this will work for you, but you can try:
- close the files that have errors in editor window (C/C++ Perspective). you can close all files.
- in “Problems” window clear all existing errors
- build the project


From what I now, the red highlited functions are reported as errors by Eclipse Code Analisys (Codan) and not by compiler/linker.
What is more intersting is the location where the compiler found the error (if there are any compiling errors).

I tried your method but still build failed.
I deleted all errors, the 2 errors appeared again when I tried to build the project.

Anyway, thank you. :-)


 

Newest Forum Posts

  1. Можно ли установить камин на балконе или лоджии? by Grand3kpdErorb, 03:38
  2. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  3. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  5. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  6. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  7. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  8. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05

Last-Modified Blogs