8 years, 11 months ago.

BSP Audio Drivers for DISCO_F746NG

I notice that the library ST / BSP_DISCO_F746NG includes only a selection of BSP drivers for this board so far. In particular, I would like to get the audio drivers (stm32746g_discovery_audio.c,.h) from STM32Cube working as well. Will this be added soon?

I've tried to add those 2 files to the library, and can get BSP_AUDIO_OUT_Init() and BSP_AUDIO_OUT_Play() to work, and the board generates a tone, but no further code is executed. To keep processing the buffer, it seems (from the Cube examples) like BSP_AUDIO_OUT_XXX_CallBack must be defined, and will then be triggered by interrupts from the buffer read states.

I have defined these, but they are never called, nor are the functions that contain them - the HAL_SAI_Tx{etc}Callbacks defined within the 2 driver files (stm32746g_discovery_audio.c,.h) - ever called. Do the interrupts need to be attached manually? It seems like HAL_SAI and the associated interrupts should be configured with BSP_AUDIO_OUT_Init(), which runs without errors.

Question relating to:

ST
A world leader in providing the semiconductor solutions that make a positive contribution to people’s lives, both today and in the future.

2 Answers

8 years, 9 months ago.

Hi, in case anyone else is struggling with this: I found out there is some issue with the default version of BSP available on mbed (the problem persists even after updating it). I replaced it with this library:

https://developer.mbed.org/users/the_sz/code/BSP_DISCO_F746NG_patch_fixed/

now everything works, callbacks are called, and main loop does not freeze.

8 years, 11 months ago.

Did you look at the code from ST for the demo code that comes on the board? It has a full audio playback routine in it with all the drivers. That uses the ST HAL interfaces not the mbed ones so you'll have to do some trimming to get it to work under mbed.

Thanks for helping out! I'm not sure what you mean by "code that comes on the board". There are a few examples that ST has put on Mbed that work quite well, but I don't see an audio example there yet. There are also a number of examples that come in the STM32Cube package. There isn't a bare metal example that is only audio for the disco board, so I've been looking at a few different examples in the /Projects/ folder, mostly the SAI_Audio examples for the 'evaluation' board, since the perepheral hardware should be the same.

I haven't gotten any examples from the stm32cube package to compile on mbed. If I exclude the mbed library for this board, and bring in the BSP drivers and necessary files, I end up getting 'multiply defined' errors with some mbed precompiled objects. I don't know how to exclude those from compile, they don't appear in any of the project files.

The next thing I will try is to download the mbed library source code for the board and try to modify some of the hal sai files to get those interrupts to register, but I'm not very familiar with this library so I thought I'd ask for pointers first.

edit: I've tried downloading the mbed library source flies and re-uploading to the simple blink example. I end up with more errors from object files (example: <<error>>Error: Undefined symbol __initial_sp (referred from entry2.o)<</error>>, so I'm pretty much stuck again short of starting from scratch with GCC.

posted by Brendan Clarke 01 Dec 2015