cancel
Showing results for 
Search instead for 
Did you mean: 

__HAL_TIM_SetCompare for complementary PWM signals

ashmithahr
Associate

Is there a way to use __HAL_TIM_SetCompare() for negated signals while generating complementary PWM signals?

Any help would be appreciated

 

1 ACCEPTED SOLUTION

Accepted Solutions

The signal on TIMx_CHxN output is the same as on TIMx_CHx output, except inverted and dead time applied.

So, there is only one TIMx_CCRx register, determining the given channel's pulse width, and that is what __HAL_TIM_SET_COMPARE() (which is a newer name for __HAL_TIM_SetCompare()) sets.

In other words, there is no separate "pulse" register for the inverted output, so there is also no separate macro to set it.

JW

View solution in original post

2 REPLIES 2

The signal on TIMx_CHxN output is the same as on TIMx_CHx output, except inverted and dead time applied.

So, there is only one TIMx_CCRx register, determining the given channel's pulse width, and that is what __HAL_TIM_SET_COMPARE() (which is a newer name for __HAL_TIM_SetCompare()) sets.

In other words, there is no separate "pulse" register for the inverted output, so there is also no separate macro to set it.

JW

FBL
ST Employee

Hello @ashmithahr 

Some examples are provided for complementary signals, you can refer to in cube firmware to activate a complementary PWM. Some macros are generally maintained simply for legacy purpose. Here is a hands on to get used to it Hands-On with STM32 Timers: Dead-time Insertion in Complementary PWM Output (youtube.com)

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.