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

Ok, I was experimenting because I literally copied and paste the code, but it seems the problem is that the version i was running in keil uvision is C++ and in the CUBE IDE was C, so I changed the C++ type file in keil to C and it works perfectly. Any idea why?

C++ uses name mangling

use form

extern "C" void EXTI0_IRQHandler(void) {

...

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

oh wow, I didn't know that, thank you very much!