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.
InterruptIn usage with port 1 pins
Hello,
If i use a port 1 pin as an interruptsource like
DigitalOut led (dp28); InterruptIn sw1 (dp17);
void test() { led = !led; }
int main() { sw1.rise(test); while(1) { wait(1.0); } }
The interrupt wont get fired. The code works fine when using a normal DigitalIn and polling in the while loop. I suspect the InterruptIn class, but code looks fine. Already tried the mode function to change to pulldown, but same result: led wont toggle. According to the datasheet it should be possible to generate an interrupt on these pins.
Any suggestions would be welcome.
Kind regards, Jan
1 Answer
10 years, 2 months ago.
You are not the first one to run into that, see: https://mbed.org/forum/bugs-suggestions/topic/4725/ and http://mbed.org/questions/2505/adafruit-cc3000-lpc1114/. I also had a very short look at the code, and indeed it looks fine. But I don't have the LPC1114, so cannot investigate myself.
Something you can try, make an interruptin object, after that set the interrupt vector directly to your function (with NVIC_SetVector, just as in the InterruptIn source code for the LPC1114). If it does get fired, the interrupt handler is wrong, if it doesn't get fired, the setup is wrong. (If you do that and it gets fired continiously, then that is normal, since your user function won't set the bit to disable it afterwards).
Edit: Had another short look at it, see https://mbed.org/forum/bugs-suggestions/topic/4725/ for something to try.