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++
12693 Discussions

IRQ on PCI Development Kit, Cyclone II Edition

Altera_Forum
Honored Contributor II
954 Views

Hello i've used IRQ without any problems in the DE2 but it isn't working in this kit (PCI Cyclone II) 

 

My IRQ code is the following.. 

 

int main() { // Enable all 4 button interrupts. IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_0_BASE, 0xf); // Reset the edge capture register. IOWR_ALTERA_AVALON_PIO_EDGE_CAP(PIO_0_BASE, 0x0); // Register the interrupt handler. alt_irq_register( PIO_0_IRQ,&edge_capture, handle_button_interrupts ); alt_irq_enable_all; alt_printf("loop start\n"); while(1) { usleep(100000); alt_printf("%x",IORD_ALTERA_AVALON_PIO_DATA(PIO_0_BASE)); //if(led==1) // { // led = 2; // initdma(); // printf("content of fifo:before DMA operation\n"); // for ( i=0;i<32;i++) // { // printf("%d: %x\n",i,IORD(FIFOWRAPPER_0_BASE,0)); // } // } // if (led==2){ // alt_printf("FIM"); // while (1){} // initdma();} // } } //alt_printf("%i:",led); //} return 0; } static void handle_button_interrupts(void* context, alt_u32 id) { // Cast context to edge_capture&#39;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&#39;s edge capture register in *context. *edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(PIO_0_BASE); // Reset the Button&#39;s edge capture register. IOWR_ALTERA_AVALON_PIO_EDGE_CAP(PIO_0_BASE, 0); led=1; //initdma(); // irq_count++; }  

 

 

I am basically counting up to 50 seconds and it should generate an IRQ.. My valid is connected to a input PIO in the sopc. 

 

//always@(posedge clk_1 or negedge resete) //begin //if(~resete) // begin // contador <= 0; // soma <= 0; // valid <= 0; // end //else //begin //valid <= 1; ////contador <= contador +1; ////valid <= 0; //// if(contador==100000000) //// begin //// contador<=0; //// soma <= soma+1; //// end //// if (soma==50) //// begin //// valid<=1; //// end //end 

 

 

That's very weird.. the exactly same verilog/ C code works for my DE2 project, why should it be different for the PCI kit?
0 Kudos
0 Replies
Reply