[En-Nut-Discussion] Problem with GpioIrqEnable

Klaus Kloos klaus.kloos at gmx.de
Thu Mar 1 19:04:24 CET 2012


Am 01.03.2012 um 18:03 schrieb zonedar:

> 
> Hi All,
> 
>  I'm working on a project where I have to use a GPIO interrupt.    I
> apologize if this has been answered before, but in doing several searches
> I've not found much on GPIO interrupts.
> 
>  My code seems to be hanging up in GpioIrqEnable, specifically at the end
> of the call to PioCtlA where it does (gpioa_at91.c):
> 
>    /* Enable interrupt. */
>    if (enabled) {
>        outr(PIOA_IER, _BV(bit));  //Never returns
>    } 
> 
> Basically it is going into outr and never leaving.
> 
Hello Steve

The code of the function GpioIrqEnable is missing. So here is a short guess...
Do you have set an IRQ-Handler for the used PIO before enabling the IRQ?
something like
	NutRegisterIrqHandler(&sig_PIOB, MyIrqHandler, NULL);
or (without NutOS)
    	outr(AIC_SVR(PIOB_ID), (unsigned int) MyIrqHandler);

Greetings Klaus

> I'm sure I'm missing something but I can't figure it out for the life of me.
> 
> I am working with an AT91SAM7X256 and NUT OS 2.0.8 (according to the
> configurator).
> 
> Here are code snippets:
> 
> void
> InitializeDSPMonitor(void)
> {
>    GpioPinConfigSet(NUTGPIO_PORTA, 14, GPIO_CFG_DEBOUNCE);
>    GpioIrqDisable(&sig_GPIO1, 14);
>    GpioRegisterIrqHandler(&sig_GPIO1, 14, DSP_Irq, NULL);
> 
>    printf("Entering InitializeDSPMonitor\n");
>    NutThreadCreate("DSP_Mon", DSP_EventMonitor, 0, 2048);
> 
>     GpioIrqEnable(&sig_GPIO1, 14);  //Hangs up here
>     printf("Leaving InitializeDSPMonitor\n");
> }
> 
> 
> Thanks!
> 
> -Steve
> 
> 









More information about the En-Nut-Discussion mailing list