AnsweredAssumed Answered

Interrupt issue with timers and exti0

Question asked by hexfet13 on Jun 1, 2015
Latest reply on Jun 1, 2015 by hexfet13
Hi all, i'm new to cortex M4 STM32F4 processor and i have some problems with external interrupt handling and internal timer interrupt. Currently i'm trying this code on a DISCOVERY F4 board (with STM32F407) and i'm trying to use a delay function addociater to a button pressure (only to perform a anti-bounce function, without external capacitor connected ti user button) with this code:


void EXTI0_IRQHandler(){
    NVIC_DisableIRQ(EXTI0_IRQn);
    EXTI_ClearITPendingBit(EXTI_Line0);
    btnPressed=1;
    delay_ms(100);
    NVIC_EnableIRQ(EXTI0_IRQn);
}

//interrupt every 1ms
void TIM7_IRQHandler(){
     TIM_ClearITPendingBit(TIM7, TIM_IT_Update);
     sysTimer++;
     if (!(sysTimer%100)) GPIO_ToggleBits(GPIO_LED,LD_GREEN);//alive led
}

Well, the code stops at "delay_ms(100)" function when i press the user button. This is bacause the sysTimer freeze it's content, because TIM7_IRQHandler isr is not server anymore. Inspecting the NVIC register i see the ISER0=10000040 before  NVIC_DisableIRQ(EXTI0_IRQn) instruction and  ISER0=10000000 . So timer2 and timer7 interrupts should works but this is not.

Can anyone tell me why? where is the mistake?

Outcomes