cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 – USB Microphone: Best way to transfer DFSDM audio data to USB Audio IN?

MannyMarc35
Associate II

 

Hi everyone,

I’m working on an audio project with an STM32H743ZIT6 and a MEMS microphone (MP34DT05-A). Audio is captured via DFSDM + DMA, and the DMA callback (HAL_DFSDM_FilterRegConvCpltCallback) fires reliably with fresh PCM audio samples.

At the moment, I am transferring the audio data to the USB Audio IN endpoint directly inside the DFSDM callback using:

USBD_LL_Transmit(pdev, AUDIO_IN_EP, buffer, packet_size);

To avoid overlapping transmissions, I set a busy flag until the DataIn callback (from the USB stack) fires. Only then do I allow the next USB packet to be sent.

This works in the sense that nothing crashes, but the actual audio stream never “starts” on the PC (e.g., in Audacity the recording stays silent and no data seems to flow).
So now I am unsure whether my current design is fundamentally flawed.

What is the correct way to link DFSDM audio → USB IN endpoint? Is it recommended to send directly from the DFSDM callback (as I do now) or push the data into a ring buffer and let a USB-SOF-driven scheduler feed the IN endpoint every 1 ms? 
How do I ensure that USB frames are served precisely every 1 ms?

If anyone has guidance, best practices or a minimal working example, I’d appreciate any help.

Thanks!

0 REPLIES 0