2026-04-15 6:03 AM - last edited on 2026-04-15 10:23 AM by Imen.D
Hi,
I want to acquire an audio signal from the microphone IMP34DT05 which is connected to the SAI interface of my STM32WB5MM-DK demo board in this way: L/R -> VDD; CLK -> SAI_CK2; DATA -> SAI_D2.
The part number I chose is STM32WB5MMGH6TR in STM32CubeIDE. I faced difficulty with SAI interfacing. I tried to enable SAI_CK2 and SAI_D2 and configured SAI A in Pulse Density Modulation (PDM) mode for microphone pairs (1–2), using CK2 as the clock. I also added additional microphone pairs (3–4).
I tried different configuration in the SAI_Init() function but in any case it doesn't work.
This is the configuration I'm using:
hsai_BlockA1.Instance = SAI1_Block_A;
hsai_BlockA1.Init.Protocol = SAI_FREE_PROTOCOL;
hsai_BlockA1.Init.AudioMode = SAI_MODEMASTER_RX;
hsai_BlockA1.Init.DataSize = SAI_DATASIZE_16;
hsai_BlockA1.Init.FirstBit = SAI_FIRSTBIT_MSB;
hsai_BlockA1.Init.ClockStrobing = SAI_CLOCKSTROBING_RISINGEDGE;
hsai_BlockA1.Init.Synchro = SAI_ASYNCHRONOUS;
hsai_BlockA1.Init.OutputDrive = SAI_OUTPUTDRIVE_DISABLE;
hsai_BlockA1.Init.NoDivider = SAI_MASTERDIVIDER_ENABLE;
hsai_BlockA1.Init.MckOverSampling = SAI_MCK_OVERSAMPLING_DISABLE;
hsai_BlockA1.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_EMPTY;
hsai_BlockA1.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_16K;
hsai_BlockA1.Init.MonoStereoMode = SAI_MONOMODE;
hsai_BlockA1.Init.CompandingMode = SAI_NOCOMPANDING;
hsai_BlockA1.Init.PdmInit.Activation = ENABLE;
hsai_BlockA1.Init.PdmInit.MicPairsNbr = 2;
hsai_BlockA1.Init.PdmInit.ClockEnable = SAI_PDM_CLOCK2_ENABLE;
hsai_BlockA1.FrameInit.FrameLength = 32;
hsai_BlockA1.FrameInit.ActiveFrameLength = 1;
hsai_BlockA1.FrameInit.FSDefinition = SAI_FS_STARTFRAME;
hsai_BlockA1.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW;
hsai_BlockA1.FrameInit.FSOffset = SAI_FS_FIRSTBIT;
hsai_BlockA1.SlotInit.FirstBitOffset = 0;
hsai_BlockA1.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE;
hsai_BlockA1.SlotInit.SlotNumber = 2;
hsai_BlockA1.SlotInit.SlotActive = 0x00000003;
What is the problem?
What am I doing wrong?
Thanks for any assistance.
2026-04-15 10:19 AM
Hello @JayanthR
Did you try the example with NUCLEO-WB55RG available under X-CUBE-MEMSMIC1 package?
2026-04-15 10:48 PM
Hi @Imen.D ,
Right now, I only have this board with me. The STM32WB5MM-DK Discovery kit is designed as a complete demonstration and development platform for the STMicroelectronics STM32WB5MMG module, based on the Arm® Cortex®-M4 and Arm® Cortex®-M0+ cores.
Is there any way to achieve MIC interfacing with the STM32WB5MM-DK or any kind of reference example which can achieve the problem?
I would appreciate any kind of help.
2026-04-17 6:15 AM
2026-04-20 5:13 AM - edited 2026-04-20 5:40 AM
Hi @JayanthR ,
We recommend using an STM32WBA65I-DK1 with the official STM32CubeWBA MCU package and available audio applications that could serve as a starting point for MIC interfacing (so, for audio over BLE 5.2 - as defined by the Bluetooth specification)
Otherwise, you can use the X-CUBE-MEMSMIC1 package that is specific for microphone acquisition for several board including P-NUCLEO-WB55 that should be the same for your board.
You can also take a look at the FP-AUD-BVLINKWB1 FW package, which provides a complete reference example for USB microphone streaming, and you can acquire audio from the onboard microphone. But note that this package is not recommended for new designs, which means the maintenance and support for this package are not provided.