Skip to main content
Sam Ho
Associate II
December 11, 2018
Question

STM32L4 Using DAC to play audio/voice files.

  • December 11, 2018
  • 8 replies
  • 3263 views

Hi,

Has anyone tried or managed to have success in playing audios or voices data using the on board DAC on STM32L452? with a speaker connecting just to the DAC.

I am at a proof of concept stage, where I am using an ST PDM microphone connected to an Nucleo L452RE board. Using DFSDM to get the PCM data and then output it to the DAC, however I am only able to hear hisses.

I have managed to generate sinewave at different frequency using different size look up table and varying TIM6 tigger.

Many Thanks!

This topic has been closed for replies.

8 replies

AvaTar
Senior III
December 11, 2018

Check out the datasheet of the L452.

The common implementation of the DAC (coming with other STM32 family members) has an output impedance of 1MOhm without buffer, or 15kOhm with enabled output buffer. Far from sufficient for speakers/headphones. And enabling the buffer uses to add up to 200mV offset to the DAC output.

I think you will need an external amplifier.

Sam Ho
Sam HoAuthor
Associate II
December 11, 2018

Thanks for your reply. Unfortunately we do not have enough space to put in an external DAC

AvaTar
Senior III
December 12, 2018

No external DAC, but an amplifier. Like an opamp.

As Rob.Riggs suggested, check if you can use the buit-in opamp.

Rob.Riggs
Senior
December 12, 2018

Have you considered using the built-in op amp? It has a PGA mode.

Peter Mather
Associate III
December 12, 2018

"Has anyone tried or managed to have success in playing audios or voices data using the on board DAC on STM32L452? with a speaker connecting just to the DAC."

Yes. I use a double buffer fed from SDcard in the main loop and a timed interrupt feeding the DAC from the current buffer. Easiest file format is .WAV - no processing needed - use a sound file converter to create suitable mono wav file

Sam Ho
Sam HoAuthor
Associate II
December 12, 2018

Hi All,

Thanks for all the suggestions, I will have at them!

Sam

kusuma
Visitor II
April 25, 2019

Hi All,

Am facing same issues after using op amp. I am only able to hear hisses.

I have done the setup like i have connected STM32L452RE DAC output to TPA0211 and from TPA0211 to speaker.

I have configured the dma configuration and Tim6 to trigger, and am using the HAL dma api to transmit the whole data at one time(like 20000 bytes).

Am i missing any configuration or am i doing in any wrong method please let me know.

Many Thanks,

Ozone
Principal
April 25, 2019

> I have done the setup like i have connected STM32L452RE DAC output to TPA0211 and from TPA0211 to speaker.

Have you checked the input impedance of the TPA0211, does it match the output impedance of the DAC ?

In normal, unbuffered configuration, the DAC has about 1 MOhm.

Have you checked the signals with a scope ?