BBB GPIO api interrupt handler problem

sudarshan.rajagopalan sudarshan.rajagopalan at vecna.com
Mon Nov 9 18:41:35 UTC 2015


On 2015-11-09 13:11, Federico Garcia Cruz wrote:
> 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;
> }

A return statement inside an interrupt handler?? Where does it return 
back to?

- Sudarshan

> 
> 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!--
> 
>  [1]
> 
> Federico Garcia Cruz
> 
> Software Engineer
> 
> San Lorenzo 47, 3rd Floor, Office 5
> 
> Córdoba, Argentina
> 
> Phone: +54 351 4217888 / +54 351 4218211
> 
>  [2] [3]
> 
> 
> Links:
> ------
> [1] http://www.tallertechnologies.com
> [2] http://www.linkedin.com/company/taller-technologies
> [3] https://www.facebook.com/tallertechnologies
> 
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel




More information about the devel mailing list