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.
8 years, 3 months ago.
NUCLEO-F746ZG InterruptIn problem
During my attempts to debug the following test code, (The interrupt for the button will not fire after adding the next interrupts whether set or not)
#include "mbed.h" DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); InterruptIn quadButton(PB_9); InterruptIn quadA(PC_9); InterruptIn quadB(PC_8); void int1() { led1 =! led1; } void int2() { led2 =! led2; } void int3() { led3 =! led3; } int main() { quadButton.rise(&int1); quadButton.mode(PullUp); quadA.rise(&int2); quadA.mode(PullUp); quadB.rise(&int3); quadB.mode(PullUp); while(true) { } }
I've been reading the initialisation code that is executed as part of the InteruptIn constructor, and during TARGET_STM32F7/gpio_irq_api.c the irqs are assigned ect, but what I can't understand is how 2 pins on different ports with the same number can be used together.
using pins PB_9 and PC_9, in gpio_irq_init() the switch statement is executed using 9 (returned from STM_PIN(pin)) so both pins are assigned to irq5, then the irq_index (5) is used to select a channel, so the pins are assigned the same channel, the channel index is selected using a lookup table returning 4 for both, then the data is stored into that index, for both, overwriting the previous data. This doesn't make much sense so I assume I've missed something.
Anyway this is a very long winded way of asking any idea whats going on with the interrupts?
it appears to be a hardware limitation, each interrupt line can only support 1 port at a time
posted by Chris Pepper 05 Aug 2016