Skip to main content
Associate II
July 31, 2025
Solved

STM32H7 DFSDM – Best way to read two microphones with one filter?

  • July 31, 2025
  • 2 replies
  • 795 views

Hi everyone,

I'm working on an audio acquisition project using the STM32H743ZIT6 microcontroller. The goal is to build a microphone array with 8 digital MEMS microphones (MP34DT05-A), connected via DFSDM and streamed over USB to a PC using the USB Audio Class (UAC). At the moment, I'm starting small and testing with one or two microphones.

So far, I have successfully configured one DFSDM filter and one channel using regular conversion with DMA, and I'm receiving valid audio data.

Now I would like to add a second microphone, which is connected to a second DFSDM channel (with opposite clock edge). Both channels should ideally be handled by the same DFSDM filter.

I'm currently wondering:

  • What is the best approach to sample two channels using a single DFSDM filter?

  • Is it necessary or recommended to use injected conversion for the second channel in this case?

  • How would I properly configure DMA and interrupts if both regular and injected conversions are used?

  • Are there any known working examples for this kind of setup?

Any tips, experiences, or suggestions would be greatly appreciated!

Thanks in advance

Best answer by Saket_Om

Hello @MannyMarc35 


@MannyMarc35 wrote:

Hi @Saket_Om ,

When you say that I need to "synchronize all channels to guarantee audio samples are synchronized", what exactly does that mean in practice?


Please follow what is done in the example DFSDM_AudioRecord.
The filter 0 should be configured to be triggered by software.

 /* Initialize filter 0 (left channel) */
 __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(&DfsdmLeftFilterHandle);
 DfsdmLeftFilterHandle.Instance = DFSDM1_Filter0;
 DfsdmLeftFilterHandle.Init.RegularParam.Trigger = DFSDM_FILTER_SW_TRIGGER;

  And the filter 1 should be configured to be synchronized with filter 0

 /* Initialize filter 1 (right channel) */
 __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(&DfsdmRightFilterHandle);
 DfsdmRightFilterHandle.Instance = DFSDM1_Filter1;
 DfsdmRightFilterHandle.Init.RegularParam.Trigger = DFSDM_FILTER_SYNC_TRIGGER;

2 replies

Technical Moderator
August 1, 2025

Hello @MannyMarc35 


@MannyMarc35 wrote:
  • What is the best approach to sample two channels using a single DFSDM filter?


The best approach is to use the injected conversion with scan conversion enabled. 

Saket_Om_0-1754056170686.png

 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"
Associate II
August 2, 2025

Hi @Saket_Om ,

thanks for your reply.

I understand that both channels can be configured by using regular and injected conversion and triggered sequentially using one trigger event. However, I have a few open questions before proceeding:

 

  • Which trigger is most suitable for injected conversions in this setup?
    I see options like TIM1_TRGO, but I'm unsure whether that's the best choice or if I should use software trigger (trigger from regular conversion)

  • Is DMA supported for injected scan conversions?
    If yes, does it automatically copy both values (one per channel) into the buffer? Or would I need to manage the transfers manually (e.g. by reading via HAL_DFSDM_FilterGetInjectedValue() in the callback)?

  • Do I need a separate DMA stream for injected conversions?
    Currently, regular conversion uses DMA1_Stream0. Can injected use the same stream, or must I set up an additional DMA handle?

  • What’s the best way to synchronize the trigger and buffer handling?
    For regular conversions, the DMA transfer completes when the buffer is full. With injected conversions triggered periodically (e.g. by a timer), how should I design the timing so I don’t miss data or cause overlaps?

Of course, some kind of example would be best, but I appreciate any help. Thanks in advance.

 

Technical Moderator
August 4, 2025

Hello @MannyMarc35 

For audio applications, it is recommended to use the regular mode, which is typically used for continuous conversions from a single channel.

Saket_Om_0-1754299880553.png

 

Please refer to the document below for more details:

STM32L4_System_DFSDM.pdf

In your application, you need to configure 8 channels and 8 filters and then synchronize all the filters with filter 0. This allows all conversions to start simultaneously.

To use DMA, you also need to configure 8 DMA streams, one for each filter.

Please refer to the example project: Projects/STM32H743I-EVAL/Examples/DFSDM/DFSDM_AudioRecord,
which demonstrates the use of 2 DFSDM channels, 2 filters, and 2 DMA streams. To add an additional DFSDM channel, you need to configure it in the same way as filter 1 in the example.

  

 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"
Associate II
August 4, 2025

Hello @Saket_Om ,

So, is it not possible or recommended to use a filter for two channels (regular + injected conversion)?
My problem is that the STM32H743ZIT6 only offers four filters and eight channels. Therefore, I wanted to use a filter for two channels.