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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Interrupts

Altera_Forum
Honored Contributor II
1,355 Views

Hi. 

I am trying to work with interrupts, which comes from external source(in my case it is external ADC).  

I am registering interrupt by: 

alt_irq_register(BUSY_IRQ, (void*)&edge_capture_ptr, A2D_ISR); 

IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUSY_BASE,0xf); 

IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUSY_BASE,0); 

 

but it does not working.Programm is crashing on "alt_irq_register". 

Maybe in order to work with interrupts i must to use VIC.At this stage i did not inserted it into HW. 

 

Thank you, Slava.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
577 Views

Can it be that the interrupt is already requested by the hardware when you register it? 

When do you enable it? 

Does your interrupt service function clears the interrupt request properly after processing it? 

 

I assume the moment you register the ISR its executed and never returns or its executed over and over again because the request is not cleared. 

 

Another problem i had was some trouble with the alt_irq_handler.c and alt_instruction_exception_entry.c. 

 

The Altera default functions end in an endless loop if you have "glitches" on your IRQ signals. This was with NIOS 9.1. 

To fix this is use modified functions.
0 Kudos
Altera_Forum
Honored Contributor II
577 Views

 

--- Quote Start ---  

Can it be that the interrupt is already requested by the hardware when you register it? 

When do you enable it? 

Does your interrupt service function clears the interrupt request properly after processing it? 

 

I assume the moment you register the ISR its executed and never returns or its executed over and over again because the request is not cleared. 

 

Another problem i had was some trouble with the alt_irq_handler.c and alt_instruction_exception_entry.c. 

 

The Altera default functions end in an endless loop if you have "glitches" on your IRQ signals. This was with NIOS 9.1. 

To fix this is use modified functions. 

--- Quote End ---  

 

 

This is my IRQ handler: 

 

# ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT 

static void A2D_ISR(void *context) 

# else 

static void A2D_ISR(void *context, u32 id) 

# endif 

 

IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUSY_BASE,0xf); 

IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUSY_BASE,0); 

a2d_fl_conversion_finished = A2D_CONV_FINISHED;  

}
0 Kudos
Altera_Forum
Honored Contributor II
577 Views

But according your description, my problem is exactly the second one.I mean 

 

--- Quote Start ---  

 

Another problem i had was some trouble with the alt_irq_handler.c and alt_instruction_exception_entry.c. 

 

--- Quote End ---  

 

So what do you mean: 

 

--- Quote Start ---  

To fix this is use modified functions. 

--- Quote End ---  

 

Do i MUST to modify these files?
0 Kudos
Reply