Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
879 Views

NIOS II Interrupt Registration

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 I
51 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 I
51 Views

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

Reply