cancel
Showing results for 
Search instead for 
Did you mean: 

External Interrupt Slow to Respond

jvavra
Associate III
Posted on April 01, 2014 at 17:23

I've got an external interrupt configured for an IO pin. It is configured for rising edge:

  /* Select the EXTI Line7 as the GPIO pin source */

  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource7);

  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;

  EXTI_InitStructure.EXTI_Line = EXTI_Line7;

  EXTI_InitStructure.EXTI_LineCmd = NewState;

  EXTI_Init(&EXTI_InitStructure);                    

  EXTI->PR = EXTI_Line7;

Further, it as set up as the highest priority:

  /* EXTI INT needs to preempt the SPI INTs, so must be higher priority */

  NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;            

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

However, by toggling an IO line high when I enter the ISR for this interrupt, I can see that frequently it is taking almost 60uS to respond. I have captured this on the scope: CH3 shows the event that should trigger the ISR, while CH1 shows the GPIO getting toggled high as soon as I enter the ISR. The first event triggers an almost immediate response (under 2uS), while the second takes around 60uS. Anyone have any idea why this interrupt is taking so long?

http://i61.tinypic.com/25gwbhl.jpg

#stm
1 REPLY 1
Posted on April 01, 2014 at 21:58

Try to write a simple minimal test program with nothing but the ISR you described (and an infinite loop in main after things are initialized).

Still long responses to the input?

JW