2024-02-15 05:20 AM - last edited on 2024-02-15 09:53 AM by Peter BENSCH
I try to control position of servo with potentiometer. I get data pot using DMA method and than i convert these data PWM signal pulse width due to control servo, but it is not working i really don't understand why does it working, servo motor is not working but i read pot in live extension and i convert this pot data which is i exactly want but I CAN NOT GET PWM OUTPUT.
What could I be missing in the clock configuration settings? i use STM32F103C6T6A and timerclocks 48MHz i set timer prescalar 959 and counter period is 999. and ADC prescalar is 12.
this is code:
while (1)
{
HAL_Delay(50);
x = (buffer[0]*150)/4096;
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1,x);
HAL_Delay(50);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
2024-03-13 01:24 AM
Hello @n01,
You need to start PWM output with HAL_TIM_PWM_Start ().
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.