[En-Nut-Discussion] SPI Interrupt Registering/Enabling

Andrew Mieczkowski Andrew.Mieczkowski at Airgas.com
Wed Mar 28 17:31:45 CEST 2007


Hello All,

   I am using Nut/OS with an AT91SAM7XC256-EK board and I am trying to
develop an interrupt driven SPI handler for simple transfers. I modified
the arm.nut file to include the ih_at91spi0.c and ih_at91spi1.c SPI
interrupt handler files in the IRQ part of the build. They seem to have
been omitted from that section of the Nut/OS configuration.

I referenced the external IRQ_HANDLER sig_SPI0.

In the initialization (code included with Nut/OS "at91_spi.c) the code
reads:

    /* Register and enable SPI0 interrupt handler. */
    NutRegisterIrqHandler(&sig_SPI0, At91Spi0Interrupt, 0);
    NutIrqEnable(&sig_SPI0);

Inside of the At91Spi0Interrupt routine is the code:

NutEventPostFromIrq(&spi0_que);

However, in my application NutEventWait(&spi0_que, 500) always times
out. I have confirmed that the interrupt routine does not get serviced,
and I have modified the mask and interrupt enable bits to get other SPI
related interrupts to cause the IRQ without success.

Is it more likely that the interrupt service routine is failing to
execute due to inadequately configured Nut/OS code or API calls (my
bad), code such as a poorly defined interrupt vector outside Nut/OS (my
bad), a combination of them (my bad), or neither? More specifically,
does anyone have suggestions on how I may rectify the situation, other
than starting at the beginning again and retracing the code as I am
already doing?

There does not seem to be much code involved with the registering and
enabling of IRQ's outside of the included ih_****.c code, so I am rather
surprised that the IRQ does not seem to be executing. Or am I
overlooking something?

Any assistance would be appreciated.

Thanks Again,

Andrew Mieczkowski





More information about the En-Nut-Discussion mailing list