cancel
Showing results for 
Search instead for 
Did you mean: 

Playing wav file using internal dac

sdura
Associate

Can you explain how to play wav file using internal DAC and how to set the frequency for wav file using timer.Since I am a beginner any help from you guys will be a great boon for me guys

1 REPLY 1

Perhaps start by outputting a wave form, say a sine wave via the DAC. Create a table containing samples.

The TIM divides down an APB clock

OUTCLK = (TIMCLK / P) / Q; where Prescaler = P-1, and Period = Q-1

You should be able to factor this where the APB clock is say 40 MHz and you want 8 KHz sample clock.

40,000,000 / 8,000 = 5,000

P = 1, Q= 5000

Prescaler = 0, Period = 4999

If you sine table has 20 samples, a DAC triggered at 8000 Hz would give you a 400 Hz sine wave

Learn to do the simpler tasks, and then combine into more complicated ones.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..