cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 TIM1_CH1N not working as PWM in complementary mode

vinodstanur
Associate II
Posted on July 03, 2016 at 01:09

 

 

The original post was too long to process during our migration. Please click on the attachment to read the original post.
4 REPLIES 4
Posted on July 03, 2016 at 03:38

It is unfortunate that the comments are not coherent with what you are doing.

So which pins do you plan on using? PA8 and PB13? Do you enable the clocks for those GPIO Banks?

Does Cube/HAL require you to enable the PWM outputs on TIM1, and for the channel pins explicitly?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vinodstanur
Associate II
Posted on July 04, 2016 at 17:22

Hi Clive1,

   Yes I enabled clock for all the PORTs for now.

   I tried both alternative pin options for CH1 CH1N.

   PE8-PE9 combination and after that PA8-PB13.

In both case the CH1N is not performing PWM action. If I modify the polarity option etc, then I can see the default level of CH1N also changing. So it seems like the CH1N pin is already in its alternate function mode but not performing PWM.

Does Cube/HAL require you to enable the PWM outputs on TIM1, and for the channel pins explicitly?

   I couldn't find any way to enable the PWM output explicitly for CH1N pin.

If I am not doing anything wrong, then what I can do now is to read the datasheet and try configuring the registers to see if there is any bug in CUBEMX.

Walid FTITI_O
Senior II
Posted on July 05, 2016 at 17:02

Hi s.vinod,

You should enable both CH1 and CH1N by applying the following:

/* Start channel 1 */ 
if(HAL_TIM_PWM_Start(&TimHandle, TIM_CHANNEL_1) != HAL_OK) 
{ 
/* Starting Error */ 
Error_Handler(); 
} 
/* Start channel 1N */ 
if(HAL_TIMEx_PWMN_Start(&TimHandle, TIM_CHANNEL_1) != HAL_OK) 
{ 
/* Starting Error */ 

Check the pulse value if iot correct . -Hannibal-
vinodstanur
Associate II
Posted on July 11, 2016 at 19:02

Thanks Hannibal. 🙂 This solved my problem.