2008-10-02 12:48 AM
Problem TIM3 CH2 PWM Partial remap (PB5) not work
2011-05-17 03:46 AM
I want use PWM function on PB.5 - remap TIM3 channel 2 but this code not work.
I connect pin PB.5 to an oscilloscope and view only high level.Code:
... GPIO_PinRemapConfig( GPIO_PartialRemap_TIM3, ENABLE); GPIO_InitTypeDef tmp; tmp.GPIO_Mode = GPIO_Mode_AF_PP; tmp.GPIO_Speed = GPIO_Speed_50MHz; tmp.GPIO_Pin = GPIO_Pin_5; GPIO_Init( GPIOB, &tmp ); TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_OCInitTypeDef TIM_OCInitStructure; TIM_TimeBaseStructure.TIM_Period = 999; TIM_TimeBaseStructure.TIM_Prescaler = 0; TIM_TimeBaseStructure.TIM_ClockDivision = 0; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_Pulse = 500; TIM_OC2Init(TIM3, &TIM_OCInitStructure); TIM_OC2PreloadConfig(TIM3, TIM_OCPreload_Enable); TIM_ARRPreloadConfig(TIM3, ENABLE); TIM_Cmd(TIM3, ENABLE); ...2011-05-17 03:46 AM
Check
: I2C1 and TIM3_CH2 remapped. The I/O port pin PB5 is set to 1 by default if the I/O alternate function output is selected and I2C1 is clocked. TIM3_CH2 cannot be used in output mode. Chris.