Skip to main content
Explorer
November 9, 2025
Solved

Newbie struggling with Complimentary Output of Timer

  • November 9, 2025
  • 1 reply
  • 332 views

Hi,

first foray into STM32 with a Nucleo-F7222ZE.

Using CubeMX I have set up Timer1 to generate PWM. I can get outputs OC1, OC2, OC3 etc, but I cannot get the complementary outputs OC1N, OC2N, OC3N to operate.

 

I feel like I'm missing something, like dead band between OC1 and OC1N for example..

I've tried just about every combination I can think of in CubeMX, with no result so far.

 

Craig

    This topic has been closed for replies.
    Best answer by TDK

    The correct function to use to start a complementary channel is HAL_TIMEx_PWMN_Start. For example, to start channel TIM1_CH2N:

    HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);

     

    > HAL_TIM_PWMN_Start

    > HAL_TIM1_PWMN_Start

    Neither of these are functions that exist in HAL. Perhaps copy/paste to avoid typos.

    1 reply

    Super User
    November 9, 2025
    Explorer
    November 9, 2025

    Hi,

    thanks for your reply, and I rather think you are on to it. I have used this:

    HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_1);

     

    to start the timer. Your reply suggests I need to start the complementary output specifically. I'll try it. 

    Thanks

    Craig

    Explorer
    November 9, 2025

    Hi, I have tried:

     

    HAL_TIM_PWMN_Start(.....

    HAL_TIM1_PWMN_Start(

     

    and  get compile errors whenever I try to include either the timer number (1) or the  'N' for complementary

     

    Craig