Skip to main content
ANNU CHERIAN
Associate II
February 19, 2018
Question

External Interrupt Issue

  • February 19, 2018
  • 4 replies
  • 1222 views
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
This topic has been closed for replies.

4 replies

Andrew Neil
Super User
February 19, 2018
Posted on February 19, 2018 at 13:33

the interrupt occurs at both rising and falling edge

How do you know that?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
ANNU CHERIAN
Associate II
February 20, 2018
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 .

Andrew Neil
Super User
February 20, 2018
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 ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
S.Ma
Principal
February 19, 2018
Posted on February 19, 2018 at 15:13

In short: Key debouncing issue to take care of.