cancel
Showing results for 
Search instead for 
Did you mean: 

External Interrupt Issue

ANNU CHERIAN
Associate II
Posted on February 19, 2018 at 13:20

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);

}

#stm32f0
4 REPLIES 4
Andrew Neil
Evangelist III
Posted on February 19, 2018 at 13:33

the interrupt occurs at both rising and falling edge

How do you know that?

S.Ma
Principal
Posted on February 19, 2018 at 15:13

In short: Key debouncing issue to take care of.

Posted on February 20, 2018 at 06:29

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 .

Posted on February 20, 2018 at 09:28

That does not answer the question.

As

Centauris.Alpha

‌ says, how do you know it's not jut

contact bounce ?