cancel
Showing results for 
Search instead for 
Did you mean: 

External interrupt Handler does not execute

JMart.13
Senior

Hi, I'm trying to execute an interrupt with the pin PCO with stm32f303re Nucleo board, but the interrupt routine never executes, actually, it just stops the program. this is my configuration code for the interrupt:

//set gpioc 0 as interrupt
       __disable_irq(); 
 	SYSCFG->EXTICR[0] |= 0x2; 
	EXTI->IMR |= (1 << 0); 
	EXTI->RTSR &= ~(1 << 0); //configure pin 0 as interrupt, fall edge 
	EXTI->FTSR |= (1 << 0);  
	NVIC_EnableIRQ(EXTI0_IRQn); 
	NVIC_SetPriority(EXTI0_IRQn, 0); 
	__enable_irq(); 

and this is my Interrupt routine:

void EXTI0_IRQHandler(void) {
	counter2++; 
	EXTI->PR |= EXTI_PR_PR0; 
}

and in the debug view i can see that the processor triggers the interrupt, but it just stuck the program and the interrupt is never executed:

before pressing the button connected to PC0:

0693W00000ANkrMQAT.pngafter pressing the button:

0693W00000ANkrgQAD.png 

Thanks for any help.

12 REPLIES 12

If you stop execution in debugger, what do you see, where is the PC, how does the ISR look like?

JW

JMart.13
Senior

when you refer to PC as the port? and which one is ISR? I know that peripherals like i2c and usart have ISR, but EXTI does not have one.

No, Program Counter, i.e. which is the currently executed instruction, is it in the ISR?

ISR is the Interrupt Service Routine Ii.e. here EXTI0_IRQHandler()); I am interested in how it looks in the disassembly view.

JW

Honestly, this is what i have seen, the compiler does not create asm code for the ISR, i don't know why, so i can't see it in disassembly view. I don't know if this helps

> the compiler does not create asm code for the ISR

That's problem.

What toolchain are you using?

Consult the toolchain's manual for proper way to use ISRs, study available examples. Some toolchains require a special way to tag ISRs, to prevent them being optimized out.

Check if the ISR's name matches that in the vector table (case sensiive), which is usualy located in the startup file.

JW

I'm using st-link for the debug and programming of the microcontroller, Keil uVision for my IDE, and the name of the handler in the startup file is "EXTI0_IRQHandler" so is correctly spelled.

Try to look at the available examples, e.g. in Cube.

JW

Is interesting, in CUBE IDE, it works perfectly :\

As opposed to what?

Try to find the differences by comparison.

JW