Altera_Forum
Honored Contributor
15 years agoIRQ not working
Hello i have a DE2-115, i am trying to generate an IRQ from a button press.
I've mapped the button in the pin planner, connected to the system template instance generated by QSys and my software has this codestatic void handle_mutex_interrupts()
{
legal = 1;
}
static void init_mutex_pio()
{
void *edge_capture_ptr;
edge_capture_ptr = (void*) &edge_capture; // cast edge_capture pointer to match alt_ic_isr_register() prototype
// Enable all 4 button interrupts.
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(INPUT_IRQ_BASE, 0x1);
// Reset the edge capture register.
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(INPUT_IRQ_BASE, 0xf);
// Register the interrupt handler.
alt_ic_isr_register( INPUT_IRQ_IRQ_INTERRUPT_CONTROLLER_ID,
INPUT_IRQ_IRQ,
handle_mutex_interrupts,
edge_capture_ptr, 0x0);
alt_ic_irq_enabler( INPUT_IRQ_IRQ_INTERRUPT_CONTROLLER_ID,
INPUT_IRQ_IRQ);
}I've configured my button as a PIO input at QSys then i configured it to generate an IRQ, edge level capture, synchronize capture and enable edge reset register. But it doesnt work. Why? My main code has a infinite loop reading the value of "legal" that should change to 1 when the IRQ happens