2017-07-25 10:20 AM
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 #dac2017-07-26 02:42 AM
Hello
must not use period 0 because the counter is blocked
8 Khz has 125 microsecond period.
presc=31 and period 124
Presc=0 and period 3999
TimHandle.
Init
.ClockDivision
=0;or other combinations..
2017-07-26 05:20 AM
I will try this solution and give you feedback! Thank you!