AnsweredAssumed Answered

Timer setting for Sound Player

Question asked by Giuseppe Giglio on Jul 25, 2017
Latest reply on Jul 26, 2017 by Giuseppe Giglio

I want to use the DAC peripheral on my stm32L073RZT to play a waveform at a given sampling frequency, 8KHz in my case.

 

I'm trying to set a timer to set a value on the dac peripheral but im struggling with the configuration.

 

Prescaler:

 

uwPrescalerValue = (uint32_t)(SystemCoreClock / 8000) - 1;

 

SystemCoreClock is at 32MHz

 

Timer Setting:

TimHandle.Init.Period            = 0;

TimHandle.Init.Prescaler         = uwPrescalerValue;

TimHandle.Init.ClockDivision     = 0;

TimHandle.Init.CounterMode       = TIM_COUNTERMODE_UP;

 

Am i doing something wrong? I used Period = 0 to enter the callback at a frequency of 8KHz, is this design correct?

 

Thank you for your help!

Outcomes