cancel
Showing results for 
Search instead for 
Did you mean: 

pwm complementery pins state once we stop pwm.

Akhan.4
Associate II

HELLO,

I am trying to implement h bridge logic to convert dc to ac but i am not sure about the pin states of complementery pwm once it stop pwm on that and how to use those compl. pwms pins as gpios .

what i am actually trying to achieve is run compl pwm for 10 ms then stop stop pwm and switch pin state to gpio (one pin being set and other reset) and this process is loop.

THANKS ,

REGARDS

ARSHAD

5 REPLIES 5

What is the question?

JW

hello waclawek sir,

1. what will be state of pin once i stop pwm (complementery pwms).

2.and how to define their pin states.

thanks

That depends on what do you mean by "stop pwm".

Maybe the easiest way is to change the given channel's mode in its respective TIMx_CCMRy.OCxM, from one of the PWMs to one of the Frozen. That then gives the output levels, the CHxN being still complementary to CHx.

You can then change the levels either by changing TIMx_CCER.CCxP/CCxNP, without changing the pins to GPIO Out.

Or, you can change the pins to GPIO Out in the respective GPIOx_MODER register, and then you can manipulate their level simply by changing GPIOx_ODR, or better, through GPIO_BSRR, as with any other GPIO Out.

JW

hello waclawek sir,

thanks for help sir being newbie to stm32 mcu i am using hal libraries for stopping pwm.(HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_1);)

sir can you please help how to

1. what will be state of pin once i stop pwm (complementery pwms).

2.and how to define their pin states.

using hal libraries.

thanks

arshad

I don't use Cube/HAL.

JW