cancel
Showing results for 
Search instead for 
Did you mean: 

cant read TIM3 counter

ozenozkaya
Associate II
Posted on July 09, 2009 at 13:23

cant read TIM3 counter

1 REPLY 1
ozenozkaya
Associate II
Posted on May 17, 2011 at 13:17

i enabled TIM2 & TIM3 and did settings like:

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;

TIM_OCInitTypeDef TIM_OCInitStructure;

/* Time base configuration */

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

/* Output Compare Timing Mode configuration: Channel1 */

TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Timing;

TIM_OCInitStructure.TIM_Channel = TIM_Channel_1;

TIM_OCInitStructure.TIM_Pulse = 0;

TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;

TIM_OCInit(TIM3, &TIM_OCInitStructure);

TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);

/* TIM IT enable */

TIM_ITConfig(TIM3, TIM_IT_CC1, ENABLE);

/* TIM2 enable counter */

TIM_Cmd(TIM3, ENABLE);

then i watch the counter value as:

a=TIM_GetCounter(TIM3);

nothing wrong with TIM2 but couldnt read TIM3 value.

what is wrong with TIM3??

thanks in advance