Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12435 Discussions

NIOS II Interrupt Registration

Altera_Forum
Honored Contributor II
923 Views

Hello, 

 

My question is with regard to using NIOS II Interrupts on a Cyclone IV E board.  

 

The NIOS II was designed using the QSYS module within quartus and a VIC was added in order to allow for external hardware interrupts. I then register the interrupt in C-code using the enhanced API. The function then returns a success (0 on success) yet the program does not hand over functionality to the ISR. 

 

Here's my registration function: 

 

int check = alt_ic_isr_register(ENCODER_INPUT_A_IRQ_INTERRUPT_CONTROLLER_ID , // Encoder A ID from System.h ENCODER_INPUT_A_IRQ, // Encoder A macro from System.h nios_isr, // Programmer defined Interrupt service routine (seeabove) base, // Optional, unused, only concerned about a single hardware interrupt NULL); // Flag -- Reserved  

 

 

and my ISR looks like this: 

 

void nios_isr(void* context) { count++; } 

 

 

Any suggestions? (Note: base is declared as null.)
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
95 Views

Are you sure the interrupt is actually triggered? The IRQ signal must stay high until the CPU sees it and runs the ISR. Then it should be the ISR that writes something to the component to say it can deassert the IRQ signal again. 

Is your count variable defined as volatile? You should do that to prevent the compiler from running some optimisations that could hide the update done by the isr routine.
Altera_Forum
Honored Contributor II
95 Views

Just a question: Is the interrupt signal hanging? You may need to clear the irq source before you leave the isr.

Reply