cancel
Showing results for 
Search instead for 
Did you mean: 

Example of PWM on TIM1 doesn't work

bfeixas
Associate II
Posted on March 04, 2010 at 10:02

Example of PWM on TIM1 doesn't work

3 REPLIES 3
Posted on May 17, 2011 at 13:42

Looking at the code we have

 /* TIM1, GPIOA and GPIOB clock enable */

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1 | RCC_APB2Periph_GPIOA |

                         RCC_APB2Periph_GPIOB, ENABLE);

Personally, I think I'd make sure the AFIO clock is enabled.

RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1 | RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOA |

                         RCC_APB2Periph_GPIOB, ENABLE);

-Clive

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bfeixas
Associate II
Posted on May 17, 2011 at 13:42

I have changed it but it still doesn't work

I need help

dwooller
Associate II
Posted on May 17, 2011 at 13:42

I have had the same problem on the STM3210E-EVAL board using A8 PWM output from timer 1. Using the IAR compiler V5.4 I have found the following

1). TIM_OCInitTypeDef , this needs to be defined outside of the initialisation function, if it is a local variable it does not work. (not sure why yet).

2). Timer 1 has a master output enable, this must be turned on. It is different from timer 3 etc. (unable to find example using timer 1 in the ST examples). After setting up the modes etc enable using the following:-

  TIM_Cmd(TIM1, ENABLE);

  TIM_CtrlPWMOutputs(TIM1, ENABLE);

Hope this helps,

Dave