4 years ago.

LPC1114 IRQ Problems on GPIO

I wrote two short test programs to try to get to the bottom of my on-going LPC interrupt problems. The way I understand it, all of the LPC1114 GPIO pins should be able to have IRQ's attached to them, bar the ones specically mentioned in the mbed LPC1114 pinout documentation. I am using dp13, dp14, dp26, dp27 and dp28. All are set for pull-up. On both versions, dp27 does NOT work - the input is not being pulled high and hovers around 100-400mV - the others are all sitting at 3.3V. My question is: Why are dp13 and dp27 not working correctly?

#include "mbed.h"
//this uses polling to check for PB going low
DigitalIn button1(dp13);
DigitalIn button2(dp14);
DigitalIn button3(dp28);
DigitalIn button4(dp27);
DigitalIn button5(dp26);

DigitalOut leds1(dp10);
DigitalOut leds2(dp11);




int main()
{

    leds1 = 1;
    leds2 = 1;
    
    wait (3);
    
    leds1 = 0; leds2 = 0;

    button1.mode(PullUp);
    button2.mode(PullUp);
    button3.mode(PullUp);
    button4.mode(PullUp);
    button5.mode(PullUp);

LOOP:   
        if((button1 && button2 && button3 && button5) == 0) {

            leds1 = 1;
            wait_ms(250);
            leds1 = 0;
            }
            
             
goto LOOP;    
}  

(Note: Button 4 was note used in the LOOP part of the specific listing above for test purposes)

****************

Listed below is the INTERRUPT driven version.

1. dp14, dp26 and dp28 work. dp13 and dp27 (as mentioned above) do not respond to low going signals. 2. If I disable all IRQ's except dp13 and dp27, I can confirm they still do not work 3. If just dp13 and dp27 are disabled, dp14, dp26 and dp28 work

#include "mbed.h"
// this uses IRQ's to check for PB's going low
DigitalOut LEDS1(dp10);
//DigitalOut LEDS2(dp11);

InterruptIn PB1(dp13);
InterruptIn PB2(dp14);
InterruptIn PB3(dp26);
InterruptIn PB4(dp27);
InterruptIn PB5(dp28);


void PB1isr(void){
    LEDS1 != LEDS1;
    }
void PB2isr(void){
    LEDS1 =! LEDS1;
    }   
void PB3isr(void){
    LEDS1 =! LEDS1;
    }   
void PB4isr(void){
   LEDS1 =! LEDS1;
    }   
void PB5isr(void){
    LEDS1 =! LEDS1;
    }   

int main()
{
    PB1.mode(PullUp); 
    PB2.mode(PullUp);
    PB3.mode(PullUp);
    PB4.mode(PullUp);
    PB5.mode(PullUp);

    PB1.fall(&PB1isr); 
    PB2.fall(&PB2isr); 
    PB3.fall(&PB3isr); 
    PB4.fall(&PB4isr); 
    PB5.fall(&PB5isr); 
    
    
    LEDS1 = 1;
    wait (3);
    LEDS1 = 0;
    wait(3);
    
do {

wait_ms(250);

__WFI();

wait_ms(250);

        } while(1);
}

Question relating to:

I tested all the GPIO pins for IRQ - I have posted the results in the LPC1114 forum.

posted by Andrew R 28 Nov 2015

1 Answer

4 years ago.

Dp27 is an easy one, it is an opendrain I2C pin: It does not have a pull up, so it is always low. What voltages do you measure on p13?

By the way, use <<code>> and <</code>> to make it better readable.

Erik, I put a 1k pull-up on p27 - it is now responding correctly (I read open drain as open drain for the output drive - I did not realize that it affected the input - good learning point).

Pin 13 has 3.3V and it goes to 0V when I hit the button, but it is not working - there is no response from the LED.

posted by Andrew R 26 Nov 2015

No idea regarding dp13, if I have time I'll try to have a look at it in the weekend. I checked some stuff, but that all seems to be set correctly.

posted by Erik Olieman 26 Nov 2015