AnsweredAssumed Answered

STM32F4 Interrupt Delay Issue

Question asked by lim.luke on Jan 24, 2013
Latest reply on Jan 24, 2013 by Clive One
Hello,

I have been working with STM32F4 Discovery for a while. I haven't had any trouble before but I found some problems that I want to know why it happens. Currently, I'm trying to use external interrupt at 125kHz but I tried to use it at 2MHz. After calculation, if I run the processor at 160MHz, I found out that it should be able to handle 2MHz. 
However, what I actually saw was little delay on interrupt. Due to this delay, the interrupt didn't work as I expected and I even wonder whether my program will be even able to run smoothly or not. It only has basic code and the code is pretty same as example code which has nothing else than interrupt and GPIO.

I'm trying to use interrupt at rising edge so my code involves
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; 
I wrote a simple code that when there is rising edge, detect it and just toggle the other pin.

and the below is what I see through the logic analyzer.
Is anyone can tell me why there is such a delay when it triggers interrupt?

delay.png

I thought interrupt service routine might take some time so I even modified it so it directly write or read through the register like:

void EXTI1_IRQHandler( void )
{
     if((EXTI->PR & EXTI_Line1)&&(EXTI->IMR & EXTI_Line1) != (uint32_t)RESET)
     {
          /* Clear the EXTI line 5 pending bit */
          EXTI->PR = EXTI_Line1;
          GPIOA->ODR ^= GPIO_Pin_2;
     }
}

Does anyone knows how to fix the issue? 

Outcomes