Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12652 Discussions

External interrupt not triggering software exception

Altera_Forum
Honored Contributor II
1,258 Views

I currently hav a push button connected up to my IRQ input on my Nios. When the button is asserted, I expect to see my program counter jump to my exceptions section in my assembly source code. When the button is asserted, I do not see this behavior. I have enabled both the ienable bit for the 0th interrupt, and the status bit PIE.  

 

Any ideas why my exception is not executing?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
540 Views

Well, this is the fastest I have ever answered my own question.. haha. 

 

At first, I only enabled bit 0 in the ienable register. I was watching the status register while debugging and noticed that the PIE bit was already set to '1'. Because of this, I did not worry about writing to it to enable it. 

 

Turns out, even though that bit was already set to '1', it was not actually allowing exceptions to occur. I had to make sure I set those bits regardless of if they were already enabled before. Seems as if they are already set, it shouldn't matter but apparently it does. Very interesting. 

 

So, if your exceptions are not being handled, make sure you are performing the following instructions. 

 

movi r8, 1 

wrctl ienable, r8 

wrctl status, r8 

 

Thanks, 

Matt
0 Kudos
Altera_Forum
Honored Contributor II
540 Views

I do however have one more question for anyone knowledgeable about IRQ's. My nios is communicating with an RTL component. This component is sending a one clock cycle "pulsed" interrupt to the Nios. Will the Nios recognize this IRQ during its instruction cycle? Both the Nios and the RTL component are operating synchronously on the same clock.

0 Kudos
Altera_Forum
Honored Contributor II
540 Views

If your interrupt pulse is too short NIOS can miss it. The best practice is to set the IRQ high (in RTL), and then reset it in NIOS in the interrupt service routine. So your RTL will also need an avalon slave port to talk to NIOS's data master.

0 Kudos
Altera_Forum
Honored Contributor II
540 Views

Nios supports level-interrupt type, which means that slave sending interrupt signals need to stay high until Nios acknowledges it by disabling it once entering ISR.

0 Kudos
Reply