AnsweredAssumed Answered

External Interrupt Issue

Question asked by ANNU CHERIAN on Feb 19, 2018
Latest reply on Feb 20, 2018 by Andrew Neil

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

Outcomes