2024-03-12 09:54 AM
Hello all,
I'm trying to learn how to control multiple servo motors with STM32.
I need to run my servos at 333Hz - and I don't know how to change the frequency from the default frequency?
Could anyone help me please - any example code / guide will be much apricated.
Gal
2024-03-12 07:11 PM
Freq = TIMCLK / ((PSC+1) * (ARR+1))
TIMCLK is typically the APBx CLK, or *2 if that's divided down from the AHB CLK
There are many STM32, can you be a bit more specific? What's the MCU clock running at?
2024-03-12 07:16 PM
For a typical 50 Hz (20 ms) Servo, off a TIMCLK of 72 MHz
PSC = 71 // Gets the counter at 1 MHz (1 us)
ARR = 19999 // Gets the frequency to 50 Hz, 20000 us, 20 ms
CCRx = 1000 to 2000 // for a pulse width of 1 - 2 ms
2024-03-14 06:49 AM
Hi, thanks for the help
I am very new to the platform can you farther explain what are the things you are setting or code example? I am using stm32f4 black pill