Skip to main content
vinayakrjoshi
Associate
Jun 17, 2015 12:46 PM UTC
Question

Updating Duty Cycle for PWM in STM32F407

Posted on June 17, 2015 at 14:46

Hi,

I am using STM32F407 uc with latest HAL lib. for PWM. In th elatest lib. there is no function provided to update the Duty cycle, reset the counter and auto reload like old driver

         TIM_SetCounter( TIM11, 0 );

        TIM_SetAutoreload( TIM11, TIM11_COUNTER );

        TIM_SetCompare1( TIM11, pulse_width );

How am i suppose to do this with new HAL driver?

pl. help me in this regard.

Vinayak

#pwm #tim #pwm-duty-cycle-update #reload #compare
This topic has been closed for replies.

1 reply

tm3341
Associate III
Jun 18, 2015 7:22 AM UTC
Posted on June 18, 2015 at 09:22

/* Set counter */
TIMx->CNT = counter_value;
/* Set autoreload */
TIMx->ARR = auto_reload_value;
/* Set compare 1 */
TIMx->CC1 = compare_value;

No need for any function calls. Just wasting time for nothing.