cancel
Showing results for 
Search instead for 
Did you mean: 

TIM channels and pin, I need a clarification!

orn
Associate II
Posted on October 11, 2012 at 13:33

TIM channels and pin, I need a clarification!

I'm looking at the example TIM_PWM_Output (STM32F4-Discovery_FW_V1.1.0)

/* PWM1 Mode configuration: Channel1 */
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = CCR1_Val;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);

because the channels are the number 1, 2, 3, 4? I'm looking for the manual but I can not understand : '- ( and because PC6 is associated Tim channel 1, while in PC7 TIM channel 2, PB0 and PB1 tim canalel 3 Tim channel 4? where they are declared these associations?

/* GPIOC Configuration: TIM3 CH1 (PC6) and TIM3 CH2 (PC7) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
GPIO_Init(GPIOC, &GPIO_InitStructure); 
/* Connect TIM3 pins to AF2 */ 
GPIO_PinAFConfig(GPIOC, GPIO_PinSource6, GPIO_AF_TIM3);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource7, GPIO_AF_TIM3); 

#tim-stm32f4
2 REPLIES 2
orn
Associate II
Posted on October 11, 2012 at 14:14

I solved it! for every person who has the same problem the solution is in the manual MCU STM32F405xx STM32F407xx, pages 45 Table 6. STM32F40x pin and ball definitions:-D

jonfs2000
Associate II
Posted on August 14, 2013 at 13:04

Thanks.. Something I'm looking for as well.