cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to stop a PWM signal?

Hrishikesh
Senior

I am wondering which is a faster way to stop PWM generation. Would it be through HAL_TIM_PWM_Stop or by setting __HAL_TIM_SET_COMPARE to zero? I'm getting SPI commands via a raspberry pi and then based on those values, I start or stop the motors. The larger issue at hand is if the commands are too close to each other, the motors do not start and stop properly and cause unexpected behavior. Hence what would be a faster way to start and stop the PWM?

2 REPLIES 2

TIM2->CCR1 = 0; ?

TIM1/TIM8 usually have a single (MOE ?) bit to disable the PWM output

Watch that suddenly stopping things can cause mechanical failures, and large voltage spikes. Be mindful.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks!