I need a timer to change its frequency every millisecond.I'm controlling a AC synchronous servo with pulse and direction in velocity mode(by changing the frequancy of the pulse) what is the ideal way
I have stm32f4 discovery board(STM32F407VGT06) running at 168Mhz.
requirement 1)
i have to run a motor (AC synchronous servo - yaskawa ) by pulse and direction.
for which i can use a timer in PWM mode with 50% duty cycle.
relation of motor rotation to pulse
360' of motor shaft rotation = 360000 pulses input. (it counts only the number of rising edges)
so if i give pulses in frequancy of 360000 Hz then i drive the motor in
1 Rotation Per Second or 60 Rotations Per Minute.
My minimum speed of operation is 0.01 degree / sec. - 10 Hz ------(0.01 *(360000/360))
my maximum speed of operation is 10 degree / sec. -10000 Hz---- (10 *(360000/360))
requirement 2.
i calculate a new velocity every milli second, and i need to change my motor frequancy every millisecond.
what is the best way to do it?
tried 2 options and failed
pwm update ARR and CCR
(ARR is pre load register ) it updates on the next cycle .
updating PSC(prescalar)
instant but can't get lot of combinations
**option 3
use a timer interrupt in time base to toggle a GPIO output // could it work?
thanks in advance.
and forgive if this doubt is very silly.
expecting your help for my project.
vallab