2012-10-02 01:53 PM
Hi guys
I run timer 1 capture interrupt GPIO_InitTypeDef GPIO_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; /* TIM1 clock enable */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE); /* GPIOA clock enable */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE); /* TIM1 channel 2 pin (PE.11) configuration */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; 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_NOPULL; GPIO_Init(GPIOE, &GPIO_InitStructure); /* Connect TIM pins to AF2 */ GPIO_PinAFConfig(GPIOE, GPIO_PinSource11, GPIO_AF_TIM1); /* Enable the TIM1 global Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = TIM1_CC_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); TIM_ICInitStructure.TIM_Channel = TIM_Channel_2; TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_BothEdge; TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI; TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; TIM_ICInitStructure.TIM_ICFilter = 0; TIM_ICInit(TIM1, &TIM_ICInitStructure); /* TIM enable counter */ TIM_Cmd(TIM1, ENABLE); /* Enable the CC2 Interrupt Request */ TIM_ITConfig(TIM1, TIM_IT_CC2|TIM_IT_Update, ENABLE); and capturing the signal with unknown sometimes it's 100 pulse sometimes it's 105. for this reason i can't detect stream end edge I want to detect counter overflow but it's seems i can't have two interrupt in same time i add this line :TIM_ITConfig(TIM1, TIM_IT_CC2|TIM_IT_Update, ENABLE);and check in this way in my while : if (TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) { TIM_ClearITPendingBit(TIM1, TIM_IT_Update); TIM1OverFlow++; }but i haven't anything .how can i access to overflow flag during capturing ?Thank you