cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI interupt not firing. Setup issue?

shannon2
Associate II
Posted on January 31, 2012 at 22:53

Here is my code block for setting up the EXTI for Port B pin 0:

void
VFD_Busy_EXTI_Init(
void
){
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_In_Floating;
GPIO_Init(GPIOB,&GPIO_Init_Structure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0);
EXTI_InitStructure.EXTI_Line = EXTI_Line0
EXTI_InitStructure.EXTI_Mode_Interupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}

Anyone see anything wrong or missing? The symptom is the EXTI ISR is never called. (yes the hardware is confirmed fine)
6 REPLIES 6
Posted on January 31, 2012 at 23:25

With local variables I'd want to be real sure I initialized them completely so they don't hold random junk.

EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interupt;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mehmet.karakaya
Associate III
Posted on January 31, 2012 at 23:29

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);

can you add this line before NVIC code and see if it works

shannon2
Associate II
Posted on February 01, 2012 at 01:41

@clive:  You had me going there for a moment!  I thought you found it.  Alas it was a transcription error in my post.  The code is actually fine.

@clive, @karakaya.mehmet:  Prioritygroup0 is set earlier in the code but I can try setting it again here.  I believe that does away with the need for the preemption priority setting you called out clive.  

I'm going to add the structure init functions to the top of this.  As clive pointed out, perhaps there is some garbage in there.

Beyond that I'm at a loss.  I will try another physical pin to see if perhaps I have a bad PB0 on two boards but it seems unlikely.  Actually as I think about it, I used the EXTI software interupt function to simulate pin change and it still didn't fire so bad pin is out.

Posted on February 01, 2012 at 03:56

If software firing isn't working, I'd be looking at the vector table, and making sure the IRQ routine is correctly named. What's the IRQ code look like, and how are you confirming if it is firing or not firing?

  EXTI_GenerateSWInterrupt(EXTI_Line0);

The hardware is presumably PB.0 pulled high, with a button to ground. Can  you get to PA.0, or play with the EXTI on other pins?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jpnorair2
Associate II
Posted on February 03, 2012 at 21:15

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_In_Floating;
GPIO_Init(GPIOB,&GPIO_Init_Structure);

Are you sure the HW is confirmed? Maybe you need to configure the input as pull-up or pull-down. - Also, in my STM32F10x library, the definition is: ''GPIO_Mode_IN_FLOATING.'' Maybe you are not using the F10x? - Finally, you should probably give a speed, like: ''GPIOinit.GPIO_Speed = GPIO_Speed_50MHz;'' If you look in stm32f10x_gpio.h, you will see that 0 is not an enumerated value supported in GPIOSpeed_TypeDef. So the result is going to be unpredictable.
esiqueira
Associate II
Posted on July 06, 2012 at 19:37

Although you have already achieved.

I decided to make an example attached.

Even simulates and it worked fine also attached.

Best Regards!!!

Erisson

________________

Attachments :

EXTI_ERISSON.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtHi&d=%2Fa%2F0X0000000aL4%2FOC.H3r79LwoNhDVf5wPbF65kCsm5VPJYq2KtTspyBqQ&asPdf=false

EXTI_PB0.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtUR&d=%2Fa%2F0X0000000aQk%2Fhl7phK161ow4q6hpNMhlXJzwNX7uqOfg97HqA8A.J3M&asPdf=false