cancel
Showing results for 
Search instead for 
Did you mean: 

Servo motor position control with potentiometer using DMA method.

n01
Associate

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. 

Screenshot 2024-02-15 161243.png

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 */

}

 

Screenshot 2024-02-15 161720.png

1 REPLY 1
Sarra.S
ST Employee

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.