Skip to main content
Visitor II
October 17, 2023
Question

Pwm mode 2 question

  • October 17, 2023
  • 2 replies
  • 6995 views

Hi, I'm studing STM32F4.

I'm looking at pwm mode in timer, and I wonder if there's a difference between using pwm mode 2 and using pwm mode 1 to invert using CCMR1 register.

    This topic has been closed for replies.

    2 replies

    MikaelM
    ST Employee
    October 18, 2023

    Hello @jiu ,

    actually they are each other opposite :

    MikaelM_0-1697610634902.png

    You could find the information in the reference manual of stm32f4 :

    https://www.st.com/resource/en/reference_manual/rm0090-stm32f405415-stm32f407417-stm32f427437-and-stm32f429439-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

    best regards

    Mikael

    If you feel a post has answered your question, please click Accept as Solution.
    waclawek.jan
    Super User
    October 18, 2023

    > difference between using pwm mode 2 and using pwm mode 1 to invert using CCMR1 register

    You mean, is PWM mode 2 identical to PWM mode 1 inverted using TIMx_CCER.CCxP? In the simple case of simple PWM output, yes.

    Difference occurs only in more complex usage, involving OCxRef signal, e.g. using the Fast mode (set by TIMx_CCMRx.OCxFE) and OCxRef clear (see TIMx_CCMRx.OCxCE). Output polarity also matters in states involving Break, see Advanced Timers.

    JW