cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX - BSP_AUDIO_IN_Record() lock/hang the program - STM32F746G-DISCO -

I am using the function BSP_AUDIO_IN_Record to read audio from line in of this evaluation board.

The data will be used to get a value to display in a Vu-meter so I don't need an extreme precision.

I have add these source in the Makefile to have all functions for this operation.

$(Drivers_path)/BSP/STM32746G-Discovery/stm32746g_discovery_audio.c \
   $(Drivers_path)/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sai.c \
   $(Drivers_path)/BSP/Components/wm8994/wm8994.c \

I have add some includes in these source to eliminate the errors in compile phase.

/* Includes ------------------------------------------------------------------*/
#include "stm32f7xx_hal_dma.h"
#include "stm32f7xx_hal_sai.h"
#include "stm32746g_discovery_audio.h"

Here the code:

void Screen2View::setupScreen()
{
#ifndef SIMULATOR
 
#define MIC_SAMPLES	128
 
    audioBuffer = (uint16_t *)malloc(MIC_SAMPLES * 2);
 
    if (BSP_AUDIO_IN_Init(INPUT_DEVICE_INPUT_LINE_1, 80, AUDIO_FREQUENCY_16K) == AUDIO_OK)
    {
        BSP_AUDIO_IN_Record(audioBuffer, MIC_SAMPLES*2);   <<<< hang here
    }
#endif
    Screen2ViewBase::setupScreen();
}

2 REPLIES 2
Martin KJELDSEN
Chief III

Hi,

I think i'll need more information to go on. When does the hangup happen? Immediately when the code is executed? Have you tried debugging? What's the application doing when it hangs?

/Martin

Martin KJELDSEN
Chief III

A side note:

It's better practice to store non-UI related code in the model. Your view has access to its presenter which has access to the model.

View:

presenter->startRecording(MIC_SAMPLES*2);

Presenter:

model->startRecording(...);

/Martin