We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi all,
i am using the stm32f4 discovery board to drive my stepper motor in the rpm of between 0.001 to 500 RPM. for this i am using pwm. my clock frequency is 32MHZ and prescale for ABP1 is divided by 2 of my clock frequency. in this i cant make my pwm to act below the frequency of 250Hz because according to the time period calculation the timer over flow value is more than 65535. i need to set my frequency range of 3.33khz to .00667Hz. some body please assist me.
Hi,
Ftimer= Ftimerclock/(ARR+1)(PSC+1); for Timer 2 for example, psc=999, ARR=27, Ftimermax=84MHz, Ftimer= 3KHz,
hi,
i used the formula
time period = sys_clk_freq/pwm_freq;
if my sys_clk_freq=16MHZ;
pwm_freq=10KHZ
so, time period = 16000000/10000;
time period=1600;// this is below 65535 so there is no problem to obtain my pulse
if my pwm freq is 240hz;
time period = 16000000/240;
time period=66666.66;// this is above 65535 so i calculated my pre scale value
prescaler= 66666/65535;
prescaler=1.017;
tme period= 65535;
i dont know whether this formula is wrong or right. but from this one i can obtain my pwm freq from 250hz to 2khz. i cant able to go more or less than that.
note: i know my clk and pwm frequency i need to calculate only my time period. please assist for that