-deleted-
11 years, 5 months ago.

mbed freeze with InterruptIn on p22-p26

Hi,

I have a question about the InterruptIn on pin 22, 23, 24, 25 and 26. My mbed lpc1768 showed some strange behavior when I used InterruptIn on these ports. So I modified the simplest InterruptIn demo to test for problems. The problem is that if I use pin 22-26 for InterruptIn and an interrupt occurs on one of those ports, the device freezes. In the documentation is suggested that p19 and p20 should not be used for interrupts, so p22-26 should be ok.

I supplied the demo code below. The device starts blinking a led when it starts. When I trigger interrupts (connect specific pin to Vout) an other led will toggle. For pin 30-27 this works as expected. For pin 26-22 the blinking led stops blinking when the first interrupt on that pin occurs (device freezes).

Can someone tell me if I am doing something wrong, or if this is a common issue, or if this is an defect of my mbed device?

Device: LPC1768 / Firmware: 21164

Thanks for your time and help! If some things are unclear, please ask!

Leon

#include "mbed.h"
 
InterruptIn button(p30);
InterruptIn button1(p29);
InterruptIn button2(p28);
InterruptIn button3(p27);
InterruptIn button4(p26);
InterruptIn button5(p25);
InterruptIn button6(p24);
InterruptIn button7(p23);
InterruptIn button8(p22);
InterruptIn button9(p21);
DigitalOut led(LED1);
DigitalOut flash(LED4);
 
void flip() {
    led = !led;
}
 
int main() {
    button.rise(&flip);  // attach the address of the flip function to the rising edge
    button1.rise(&flip);
    button2.rise(&flip);
    button3.rise(&flip);
    button4.rise(&flip);
    button5.rise(&flip);
    button6.rise(&flip);
    button7.rise(&flip);
    button8.rise(&flip);
    button9.rise(&flip);
    while(1) {           // wait around, interrupts will interrupt this!
        flash = !flash;
        wait(0.25);
    }
}

1 Answer

11 years, 5 months ago.

Hi Leon, you spotted a bug in the new LPC1768 InterruptIn interrupt handler. We fixed that in Rev 52.

Cheers, Emilio

Accepted Answer