2010-03-04 01:02 AM
Example of PWM on TIM1 doesn't work
2011-05-17 04:42 AM
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); -Clive2011-05-17 04:42 AM
I have changed it but it still doesn't work
I need help
2011-05-17 04:42 AM
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