2014-05-05 09:31 AM
I want to set falling egde interrupt for PA15. I did below setting, but problem is interrupt occurs on both edges.
Pin is pulled up by 2.7K register to 5V.I debug the code RTSR register has bit15 = 0, i.e rising edge disabled.Didn't change RTSR & FTSR anywhere else in code.void EXTI15_10_IRQHandler(void){ /* clear isr flag */EXTI->PR = REG32_BIT_15;// do something}void init(){/* make as input encoder I */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_Init(GPIOA, &GPIO_InitStructure); SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource15); EXTI->PR = REG32_BIT_15; EXTI->FTSR = (0xFF800000U & EXTI->FTSR) | REG32_BIT_15; EXTI->IMR = (0xFF800000U & EXTI->IMR) | REG32_BIT_15; /* Enable and set EXTI Line2 Interrupt to the lowest priority */ NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); }2014-05-06 08:22 AM
Hi
''I want to set falling egde interrupt for PA15. I did below setting, but problem is interrupt occurs on both edges.'' Are you sure? Could it be that you are getting contact 'bounce' - which give multiple IRQs - makes it look like IRQ on both edges.