BBB GPIO api interrupt handler problem

Federico Garcia Cruz federico.garciacruz at tallertechnologies.com
Mon Nov 9 18:11:56 UTC 2015


Hi everyone,
I'm using the GPIO api for the BBB but I'm having problems with the
interrupt handling.
I'm blinking two leds in the main thread and I have a GPIO input with an
interrupt attached that uses printk to print a message. The problem is that
the interrupt handler prints the message but never returns (main thread
leds stop blinking after that).
Any suggestion?
Here's my code:

rtems_gpio_irq_state gpio_handler(void* /*arg*/)
{
    printk("interrupt handler\n");
    return IRQ_HANDLED;
}


void* POSIX_Init(void*)
{
    rtems_mode previous_mode_set;
    rtems_task_mode(RTEMS_TIMESLICE | RTEMS_PREEMPT, RTEMS_TIMESLICE_MASK |
RTEMS_PREEMPT_MASK, &previous_mode_set);
    rtems_status_code sc = rtems_gpio_initialize();
    printk("%d\n", sc);

    sc = rtems_gpio_request_pin(BBB_LED_USR0, DIGITAL_OUTPUT, true, false,
NULL);
    printk("DIGITAL_OUTPUT: %d\n", sc);
    sc = rtems_gpio_request_pin(BBB_LED_USR3, DIGITAL_OUTPUT, true, false,
NULL);
    printk("DIGITAL_OUTPUT: %d\n", sc);

    sc = rtems_gpio_request_pin(BBB_P8_7, DIGITAL_INPUT, false, false,
NULL);
    printk("DIGITAL_INPUT: %d\n", sc);

    sc = rtems_gpio_enable_interrupt(BBB_P8_7, FALLING_EDGE,
UNIQUE_HANDLER, false, gpio_handler, NULL);
    printk("interrupt install: %d\n", sc);

    while(1)
    {
        sleep(1);
        rtems_gpio_clear(BBB_LED_USR3);
        rtems_gpio_set(BBB_LED_USR0);
        sleep(1);
        rtems_gpio_set(BBB_LED_USR3);
        rtems_gpio_clear(BBB_LED_USR0);
    }
    return NULL;
}

Thanks in advance!
-- 

<http://www.tallertechnologies.com>


Federico Garcia Cruz

Software Engineer


San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina


Phone: +54 351 4217888 / +54 351 4218211


<http://www.linkedin.com/company/taller-technologies>
<https://www.facebook.com/tallertechnologies>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20151109/61c5941b/attachment.html>


More information about the devel mailing list