Altera_Forum
Honored Contributor
21 years agoNios I - Wrong IRQ Vector
I recently noticed a problem with a Nios (not Nios II) design implemented on an APEX EP20K device. At initialization, I set all entries in the interrupt vector table to point to the same routine: it displays the IRQ number and PC of the interrupted code and then runs a small debugger (this routine has been carefully tested). Later, the code installs interrupt handlers for a few specific interrupts: 26 - a Nios UART (shared with the GERMs monitor), 18 - a Nios timer (used by a RT-executive), and 25 - a Nios PIO register which includes the IRQ signals from two external octal UART chips.
The timer always generates interrupts at 500 Hz. The frequency of interrupts from the octal UARTs depends on the number of external devices attached (more replies, and more Rx interrupts), but should be several hundred per second (the Nios UART for GERMs and console output is idle). As I increased the number of attached devices, the unexpected IRQ handler was being invoked (just a few times a day). These are always for IRQs 19 and 27. There is no hardware (or Nios peripheral) for IRQ 27, and IRQ 19 is assigned to an unused Nios UART. Using the debugger, I've confirmed that these spurious IRQs are not the result of executing a TRAP instruction - I've checked the code in RAM at the interrupted location using the debugger from the unexpected IRQ handler. When IRQ 19 happens, I've confirmed that the interrupt enable register of the Nios UART is still zero. I'm wondering, could this be a problem with the Nios logic generating the IRQ vector: my symptoms are consistent with what would happen if the vector was latched just as it was transitioning from 25 to 18: I could get 18, 19, 25, 26 and 27 - just what I'm seeing (I wouldn't notice a spurious IRQ 26, since this has a handler). The spurious interrupt frequency seems to increase as I increase the frequency of interrupts from the external UARTs (via Nios PIO), exactly what I'd expect for this scenario. Is this a known problem? Has anyone else seen anything similar. Is there a hardware (i.e. FPGA design) solution?