Timer setting for Sound Player
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!
#timer #sound #stm32l0 #dac