Example of PWM on TIM1 doesn't work
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2010-03-04 1:02 AM
Posted on March 04, 2010 at 10:02
Example of PWM on TIM1 doesn't work
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:42 AM
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..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:42 AM
Posted on May 17, 2011 at 13:42
I have changed it but it still doesn't work
I need help
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:42 AM
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