cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI_Input Capture

nechi
Associate III
Posted on September 11, 2015 at 13:23

Hi ,

I'm using STM32F103 and i have an input signal on Timer1_ch3 (PA10) which generates an EXTI interrupt and it's working well.

I have another input signal on Timer2_ch3, but something strange happens when i connect this signal on the default Timer2_ch3 pin (PA2),

it affects the EXTI interrupt and it becomes generated twice : one time like previous with the first signal and second time with the falling edge of the second signal!!!

but when i avoid PA2 and remap the Timer2_ch3 on PB10 it works well. i can't understand why and i need to use PA2. 

void Init(void) 

 {

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;                                

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 

    GPIO_Init(GPIOA, &GPIO_InitStructure);  

    

    GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_10 ;                                

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 

    GPIO_Init(GPIOB, &GPIO_InitStructure); 

    

    GPIO_PinRemapConfig(GPIO_FullRemap_TIM2, ENABLE);

    

   /*  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_2 ;           // if i use PA2                     

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 

    GPIO_Init(GPIOA, &GPIO_InitStructure); */

 

 GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource10);

  EXTI_InitStructure.EXTI_Line = EXTI_Line10;

  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;  

  EXTI_InitStructure.EXTI_LineCmd = ENABLE;

  EXTI_Init(&EXTI_InitStructure); 

  NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure); 

    

}
0 REPLIES 0