Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 2 months ago. This question has been closed. Reason: Problem Resolved
Interrupt on Nucleo
I have a working programme that I've written for the KL25Z that is triggered from a second KL25Z. I'm trying to convert if for use on the F401RE board but I can't get the interrupt callback to be triggered. I've tried several different ports that I'm defining as InterruptIn and I'm using a falling edge trigger.
I know with the KL25Z that Interrupts would only work on certain groups of ports is this the case with the Nucleo boards or isn't this capability supported yet?
1 Answer
10 years, 2 months ago.
Can't you get it to be triggered, or does it tell you that the pin doesn't support InterruptIn? (On a serial terminal).
Anyway, STM manuals are well hidden, but managed to find it in the end (at least of another one from the same family, but should be the same). The following pins can be used for InterruptIn:
switch (pin) { case PC_13: // User button irq_n = EXTI15_10_IRQn; vector = (uint32_t)&gpio_irq0; irq_index = 0; break; case PB_3: irq_n = EXTI3_IRQn; vector = (uint32_t)&gpio_irq1; irq_index = 1; break; case PB_4: irq_n = EXTI4_IRQn; vector = (uint32_t)&gpio_irq2; irq_index = 2; break; case PB_5: irq_n = EXTI9_5_IRQn; vector = (uint32_t)&gpio_irq3; irq_index = 3; break; default: error("InterruptIn error: pin not supported.\n"); return -1;
The good news, if they add proper code according to the datasheet you can add an interruptin on every single input. Downside is that it seems to kinda lack registers to see which interrupt was triggered. What should be possible is an interruptin on every pin with a seperate number, so PA_1, PB2, PA3, PC4, etc. But currently the code cannot handle that...
Can you share a snippet of your code or at least what pins you have tried?
posted by Martin Kojtal 28 Feb 2014Here is my test code, only the USER_BUTTON Works
Interrupt Test