2014-03-04 02:10 PM
I'm trying to do a pin interrupt (EXTI). My code: // IRQ handler for EXTI0
void EXTI0_IRQHandler ( void ) { EXTI->PR = 1UL << 0; buttonPress = 1; }int
main ( void ) { // some system stuff here ...GPIO_PortClock (GPIOD,
true ); GPIO_PinConfigure(GPIOD, 0, GPIO_MODE_INPUT, GPIO_OUTPUT_PUSH_PULL, GPIO_OUTPUT_SPEED_25MHz, GPIO_PULL_UP); // EXTI line 0 EXTI_ConfigureLine(0, EXTI_MODE_INTERRUPT, EXTI_TRIGGER_FALLING); // Port D EXTI_ConfigurePin(0, EXTI_PIN_PD); NVIC_EnableIRQ(EXTI0_IRQn);// ... etc
} The problem is, whatever port I have on the EXTI_ConfigurePin(), the interruption goes to port A. So the PA0 always triggers the handler, not PD0 or whatever I'm trying to use. The functions I'm using are KEIL. I suppose they are working right, so did I forget some step, or what could it be causing the problem? #exti #discovery #stm32f42014-03-04 07:20 PM
Not familiar with the library you're using, review the EXTI example projects in ST's library
I'd hazard you need to enable the SYSCFG clock if you want to change the EXTI pin routing. It only supports one pin per line.2014-03-05 02:12 AM
Yeah, the SYSCFG clock, that did it! Thanks, Clive1!
In Keil uVision, there is a file named RTE_Device.h. If you open it, you'll see a configuration wizard tab under the text editor. From there you just open ''EXTI controller'' and enable it. Then just call EXTI_Setup() in your code, and that enables that SYSCFG clock. In fact, that wizard can also do the EXTI_ConfigureLine and EXTI_ConfigurePin stuff for you. But then you can't have EXTI0_IRQHandler() in your code, but EXTI0_Event(). Quite handy, but if I'll use this, I guess no-one can read my listings... By ST's library, you mean STM32Cube firmware, right? I found an EXTI example there.2014-03-06 05:32 AM
No, the original firmware library they deprecated the other week, but most everyone else is still using it.
http://www.st.com/web/en/catalog/tools/PF257901