9 years, 3 months ago.

EA LPC4088 interrupt input

using the interruptin example, generates an error and does not work board

1 Answer

9 years, 3 months ago.

Hi,

I got following runtime error using InterruptIn example:

pins on this port cannot generate interrupts

The reason of this is the device only supports GPIO0 and GPIO2 for GPIO interrupt. In gpio_irq_init() function of gpio_irq_api.c, it checks available port for interrupt input.

int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
    if (pin == NC) return -1;
    
    irq_handler = handler;
    
    obj->port = ((int)(LPC_GPIO0_BASE+pin) & ~0x1F);
    obj->pin = (int)pin % 32;
    
    // Interrupts available only on GPIO0 and GPIO2
    if (obj->port != LPC_GPIO0_BASE && obj->port != LPC_GPIO2_BASE) {
        error("pins on this port cannot generate interrupts");
    }

Pinname 'p5' is defined as P1_24 in target specific PinNames.h.

Therefore, you can not use 'p5' pin for InterrutIn API using the EA LPC4088 target.

Accepted Answer

Thank you very much for your answer, I have modified the entry and everything works ok.

posted by Javier Dominguez Blanco 05 Jan 2015