2024-03-21 03:52 AM - last edited on 2024-03-21 04:53 AM by SofLit
I set the parameter of TIM5 of my MCU on CubeMX,the frequency of the clock is 72 MHz,PSC is 7199,ARR is 199,the information about my settings is below:
TIM5 is used to output 4 channels of PWM to control four SG90 servos,TIM1 toTIM4 is used to control four Ultrasonic ranging module,I use this sentence to initialize four servos:
I think these servos should turn to 0 degree,but in fact it turn to 90 degrees and stuck there,I don't know the reason why it happened.I hope someone can heip me solve this problem,it has been made me confused for several days
2024-03-21 04:53 AM
Hello,
Check if your PWM timings fit the servo requirements:
2024-03-21 05:06 AM
PWM frequency=(ARR+1)*(PSC+1)/72MHz=0.2s=20ms,
if I want to make four sevros turn to 0 degree,I should give it a high level for 0.5ms,so
0.5/20*200=5, I think my PWM setting is okay.Can you provide me another suggestion?Thank you very much!!
2024-03-21 05:15 AM
2024-03-21 05:35 AM - edited 2024-03-21 05:48 AM