cancel
Showing results for 
Search instead for 
Did you mean: 

Problem TIM3 CH2 PWM Partial remap (PB5) not work

faradey
Associate II
Posted on October 02, 2008 at 09:48

Problem TIM3 CH2 PWM Partial remap (PB5) not work

2 REPLIES 2
faradey
Associate II
Posted on May 17, 2011 at 12:46

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);

...

christophe239955_st
Associate II
Posted on May 17, 2011 at 12:46

Check

http://www.st.com/stonline/products/literature/es/14574.pdf

: 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.