Question
TIM1_CC_IRQHandler is not called
Posted on April 11, 2012 at 20:46
Hi,
I`m working with the STM32F103XC processor (lqfp144 package) and I want to use the input capture mode for the Timer1. At the moment I didn`t get any timer interrupt while the I/O PE13 has a lot of rising edges. Maybe there`s something wrong with the PE13 pin which has as alternative function TIM1_CH3. Here`s my init code.RCC->APB2ENR |= (
1
<<6
);// enable peripheral clock for GPIOE
/* INT input PE13 -> mit timer1 verwenden */
GPIOE->CRH &= ~0x00F00000
;// reset port-pin
GPIOE->CRH |=0x00400000
;// set input mode floating
RCC->APB2ENR |= RCC_APB2Periph_TIM1;/* Enable the TIM3 global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIM1_CC_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0
; NVIC_InitStructure.NVIC_IRQChannelSubPriority =1
; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); TIM_TimeBaseStructure.TIM_Period =0xFFFF
; TIM_TimeBaseStructure.TIM_Prescaler =1
; TIM_TimeBaseStructure.TIM_ClockDivision =0
; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStructure.TIM_RepetitionCounter =0
; TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure); TIM_ICInitStructure.TIM_Channel = TIM_Channel_3; TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_IndirectTI;//PE13
TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;// Div:1, every edge
TIM_ICInitStructure.TIM_ICFilter =0x0
; TIM_ICInit(TIM1, &TIM_ICInitStructure); TIM_ClearITPendingBit(TIM1, TIM_IT_CC3); TIM_ITConfig(TIM1, TIM_IT_CC3, ENABLE);/* TIM enable counter */
TIM_Cmd(TIM1, ENABLE);/* TIMER interrupt routine: wird nie aufgerufen */
void
TIM1_CC_IRQHandler (void
) {if
(TIM1->SR & TIM_IT_CC3) {/* capture timer */
TIM1->SR = (unsigned
short
)~TIM_FLAG_CC3; } } best regards Hans