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++
告知
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.
12748 ディスカッション

Problem with getting IRQ from PIO (Really simple i guess)

Altera_Forum
名誉コントリビューター II
1,586件の閲覧回数

int context=0; volatile int edge_capture; int main() { IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_0_BASE,0xF); alt_irq_register(PIO_0_IRQ,(void*)&edge_capture, handle_pio); while(5); return 0; } static void handle_pio(void* context, alt_u32 id){ IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_0_BASE, 0); /* Cast context to edge_capture's type. It is important that this be * declared volatile to avoid unwanted compiler optimization. */ volatile int* edge_capture_ptr = (volatile int*) context; /* Store the value in the Button's edge capture register in *context. */ *edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(PIO_0_BASE); IOWR_ALTERA_AVALON_PIO_EDGE_CAP(PIO_0_BASE,0); IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_0_BASE,0xF); } Why the interrupt never happens? It's a simple PIO (1bit)that i set to 1 in my verilog code (configured to generate a rising edge irq on my SOPC).. Thanks

0 件の賞賛
2 返答(返信)
Altera_Forum
名誉コントリビューター II
518件の閲覧回数

you not only need to enable interrupts on the PIO core, but on the NIOS side as well. 

 

you can enable and disable interrupts using alt_irq_enable and alt_irq_disable. 

 

try adding this after you register your ISR.  

 

alt_irq_enable(PIO_0_IRQ);
Altera_Forum
名誉コントリビューター II
518件の閲覧回数

Thanks a lot!! It works

返信