cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Duty Cycle for PWM in STM32F407

vinayakrjoshi
Associate II
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
1 REPLY 1
tm3341
Associate II
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.