Skip to main content
TBerg
Associate II
August 28, 2018
Question

Hi! I wonder if someone knows if I should be able to generate an interrupt at a value of the counter when I am in PWM1-mode? I.e.: TIM_ITConfig(TIM1, TIM_IT_CC1, ENABLE) together with TIM_OCInitStructure.TIM_Pulse = value; If possible, how!? Tomas

  • August 28, 2018
  • 4 replies
  • 1033 views

..

    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    August 28, 2018

    Yes, use whichever channel is available to set the phase of the count you're interested in.

    TIM1->CCR4 = X, and enable the CC4 interrupt

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    TBerg
    TBergAuthor
    Associate II
    August 29, 2018

    Hi Clive,

    Ok, I think I was too short in my description..

    I still want my pwms to work. What I look for is an overflow interrupt so that every pwm-channel maintains its dutycycle that I've set in the TIM1->CCR1 register. There is no free CCR-channel to use.

    Very thankful for your effort!

    BR

    Tomas

    TBerg
    TBergAuthor
    Associate II
    August 29, 2018

    Hi again,

    Just want to post how the issue was solved.

    I used the TIM1_UP_IRQHandler interrupt and configured it to generate an interrupt at each over- and underflow.

    Thanks,

    /Tomas

    Khouloud GARSI
    Technical Moderator
    August 29, 2018

    Hi @TBerg​ ,

    Thanks a lot for sharing the solution. For sure, this will be helpful for other users facing the same issue.

    Khouloud.