AnsweredAssumed Answered

stm32 timer captur

Question asked by mahdi zamani on Nov 20, 2016
Latest reply on Nov 20, 2016 by mahdi zamani
hey all
i configed timer 3 whit this ....
for measurement frecuncy in PA.7 
void TIM3_Configuration(void){
 
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
 
    TIM_ICInitTypeDef  TIM_ICInitStructure;
 
  TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;
  TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;
  TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;
  TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
  TIM_ICInitStructure.TIM_ICFilter = 0x0;
 
  TIM_ICInit(TIM3, &TIM_ICInitStructure);
 
  /* TIM enable counter */
  TIM_Cmd(TIM3, ENABLE);
 
  /* Enable the CC2 Interrupt Request */
  TIM_ITConfig(TIM3, TIM_IT_CC2, ENABLE);
 
  NVIC_InitTypeDef NVIC_InitStructure;
 
  /* Enable the TIM3 global Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
}

i read captur whit this code :
frq=TIM_GetCapture2(TIM3);
but not work :(((

please help to me ...
thanks

Outcomes