AnsweredAssumed Answered

.wav player based on STM32F407 using internal DAC

Question asked by traczyk.konrad on Aug 30, 2015
Latest reply on Aug 30, 2015 by Clive One
Hi, as specified in the topic, I'm trying to create my own wave file player using f4-discovery board. I've managed to configure the DAC, read the file, find the data section, read the samples and I can hear the sound, but it's full of noise. I can hear very clearly the high tones, such as flute and guitarre, but the rest sound frequencies are distorted. There is almost no bass.

The files have 2 channels, with 16bit samples and sample rate 44100Hz.

I use both channels of DAC, using 12bit left aligned registers and conversion triggered by TIM7. The samples before conversion are increased by 32768 in order to get an unsigned value.  The output buffers are turned on. The output is driving an external amplifier which drives headphones.

I've tried to use the Li-Poly battery to power the board and its still the same. I've checked if the sample buffer is filled faster then the currently used buffer and it is.  I don't have an oscilloscope at hand so I can't tell anything more. Do I do anything wrong or it's hardware fault?

Here's my code:
DAC triggering timer IRQHandler:
http://pastebin.com/CTh1r4X9

DAC configuration: (params: dac_dual_channel_simultanous, dac_trigger_tim7, true)
http://pastebin.com/NwqDr5rA

Thanks in advance for any reply.

Outcomes