Skip to main content
Visitor II
February 15, 2024
Question

Servo motor position control with potentiometer using DMA method.

  • February 15, 2024
  • 1 reply
  • 4056 views

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

    This topic has been closed for replies.

    1 reply

    ST Employee
    March 13, 2024

    Hello @n01

    You need to start  PWM output with HAL_TIM_PWM_Start ().