Skip to main content
Visitor II
March 19, 2021
Question

Best way to stop a PWM signal?

  • March 19, 2021
  • 1 reply
  • 1475 views

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?

    This topic has been closed for replies.

    1 reply

    Graduate II
    March 19, 2021

    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.

    Visitor II
    March 20, 2021

    Thanks!