2018-02-19 04:20 AM
We are using stm32f051r4t6 for a new project and the IDE is Keil V5 . We are generating an external interrupt on Pin PC2 . The hardware set up is a push button in pull down arrangement whose interrupt should occur at rising edge , but for us the interrupt occurs at both rising and falling edge . Please help us to solve this issue . The code is as follows ....Any help would be appreciated .
void ext_interruptInit()
{ RCC->AHBENR |= RCC_AHBENR_GPIOCEN; RCC->APB2ENR |= (RCC_APB2ENR_SYSCFGEN); SYSCFG->EXTICR[0] |= (SYSCFG_EXTICR1_EXTI2_PC); EXTI->IMR = 0x0004; EXTI->RTSR = 0x0004; /* EXTI->FTSR = 0x0004; */ NVIC_EnableIRQ(EXTI2_3_IRQn);}void EXTI2_3_IRQHandler(void)
{ GPIOC->MODER |= BIT(20); GPIOC->ODR ^= BIT(10); EXTI->PR |= (EXTI_PR_PIF2);}#stm32f02018-02-19 04:33 AM
the interrupt occurs at both rising and falling edge
How do you know that?
2018-02-19 06:13 AM
In short: Key debouncing issue to take care of.
2018-02-19 10:29 PM
When push button is in pull down arrangement and pull up arrangement , and when Rising trigger ( EXTI_RTSR) is enabled for input line, the interrupt occurs at both the cases .
2018-02-20 01:28 AM
That does not answer the question.
As
Centauris.Alpha
says, how do you know it's not jut contact bounce ?