Showing results for 
Search instead for 
Did you mean: 

How to Record audio in STM32U5 (B-U585I-IOT02A)

Associate II

Hello Community,

I'm working on stm32u5(B-U585I-IOT02A). B-U585I-IOT02A has two digital mics, and St officially has an example of BSP to record audio.

So after taking references from:

I've started the project but I'm getting issues with initializing BSP_AUDIO_IN_Init(0, &AudioInit), when I'm calling this function I'm getting: bsp_error_periph_failure(-4)

I don't know where I'm lagging can anyone provide me a solution to fix this error?

I really appreciate any help you can provide.

ST Employee

Hi @radeshsharma​ ,

Can you check that you are using the right microphone (AUDIO_IN_DEVICE_DIGITAL 1 OR 2)? And that it is connected to the right place?



Associate II

Hello @Diane POMABIA​ 

Thanks for your response. I was using AUDIO_IN_DEVICE_DIGITAL_MIC1 it was throwing bsp_error_periph_failure(-4), but after changing it to AUDIO_IN_DEVICE_DIGITAL_MIC2 it didn't throw any error but still, the recording didn't start. I tried to debug it. So, I tried to run the code line by line and I got to know things were becoming no response after reaching inside int32_t BSP_AUDIO_IN_Record(uint32_t Instance, uint8_t *pData, uint32_t NbrOfBytes)--> HAL_MDF_AcqStart_DMA(&haudio_in_mdf_filter[1], &filterConfig, &dmaConfig) --> MDF_AcqStart(hmdf, pFilterConfig); at this point code doesn't response anything, didn't throw any error just go loop.

Do you have any suggestions on this?