2020-05-18 05:22 AM
Hi
I am trying to generate pwm on the stm32f411re using LL drivers . i am using a Vnh2spa30 motor driver, i am using the setcompare() and generateupdate() commands. I am trying to use the Timer2 ch1 on pa15. I have configured the timer to internal clock. I am using a prescalar of 8399 and ARR of 99. my main problem is that no matter what argument i pass (except 0) in the setcompare() my motor runs on full speed, unless i put a delay, the bigger the delay is the slower the motor rotates
i cant figure out where i am going wrong
2020-05-18 05:38 AM
Post the code you're using to initialize the motors.
LL_TIM_OC_SetCompareCH1() and similar should change the PWM. Since your ARR=99, putting this anywhere from 0 to 100 should vary the duty cycle accordingly.
2020-05-18 05:40 AM
hi thank you for the reply
LL_TIM_OC_SetCompareCH1(TIM2, 10); //set the new value for the duty cycle
LL_TIM_GenerateEvent_UPDATE(TIM2);
LL_GPIO_SetOutputPin(GPIOC,LL_GPIO_PIN_10); //INA motor1
LL_GPIO_ResetOutputPin(GPIOC,LL_GPIO_PIN_11);// INB motor 1
this is what i am using
2020-05-18 05:47 AM
but no matter what value i put for X..... LL_TIM_OC_SetCompareCH1(TIM2, x);.... the pwm is always at 100%duty cycle
2020-10-14 09:31 AM
Dear @Rjain.1
Do you have still this problem to solve?
Best regards
Laurent Ca...
2020-10-20 07:38 AM
Dear @Rjain.1
I guess you don't have to solve this problem anymore, therefore I consider this thread closed.
If not, feel free to reopen it by posting a new answer.
Best regards
Laurent Ca...