Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Interrupts

Hi.

I am trying to work with interrupts, which comes from external source(in my case it is external ADC).

I am registering interrupt by:

alt_irq_register(BUSY_IRQ, (void*)&edge_capture_ptr, A2D_ISR);

IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUSY_BASE,0xf);

IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUSY_BASE,0);

but it does not working.Programm is crashing on "alt_irq_register".

Maybe in order to work with interrupts i must to use VIC.At this stage i did not inserted it into HW.

Thank you, Slava.

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Can it be that the interrupt is already requested by the hardware when you register it?

    When do you enable it?

    Does your interrupt service function clears the interrupt request properly after processing it?

    I assume the moment you register the ISR its executed and never returns or its executed over and over again because the request is not cleared.

    Another problem i had was some trouble with the alt_irq_handler.c and alt_instruction_exception_entry.c.

    The Altera default functions end in an endless loop if you have "glitches" on your IRQ signals. This was with NIOS 9.1.

    To fix this is use modified functions.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Can it be that the interrupt is already requested by the hardware when you register it?

    When do you enable it?

    Does your interrupt service function clears the interrupt request properly after processing it?

    I assume the moment you register the ISR its executed and never returns or its executed over and over again because the request is not cleared.

    Another problem i had was some trouble with the alt_irq_handler.c and alt_instruction_exception_entry.c.

    The Altera default functions end in an endless loop if you have "glitches" on your IRQ signals. This was with NIOS 9.1.

    To fix this is use modified functions.

    --- Quote End ---

    This is my IRQ handler:

    # ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT

    static void A2D_ISR(void *context)

    # else

    static void A2D_ISR(void *context, u32 id)

    # endif

    {

    IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUSY_BASE,0xf);

    IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUSY_BASE,0);

    a2d_fl_conversion_finished = A2D_CONV_FINISHED;

    }
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    But according your description, my problem is exactly the second one.I mean

    --- Quote Start ---

    Another problem i had was some trouble with the alt_irq_handler.c and alt_instruction_exception_entry.c.

    --- Quote End ---

    So what do you mean:

    --- Quote Start ---

    To fix this is use modified functions.

    --- Quote End ---

    Do i MUST to modify these files?