cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 Using DAC to play audio/voice files.

Sam Ho
Associate II

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!

8 REPLIES 8
AvaTar
Lead

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
Associate II

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

Rob.Riggs
Senior

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

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

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

Peter Mather
Associate III

"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
Associate II

Hi All,

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

Sam

kusuma
Associate

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,

> 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 ?