UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
7,385 Views
Registered: ‎10-07-2014

Application getting hanged while enabling interrupts for custom ip

Hi,

 

I'm trying to generate two interrupts from custom ip. But the application is getting hanged while enabling interrupts.

To generate interrupts, I followed the below process:

 

1. In user_logic.vhd file :

 

  Int_Fpga_Ack_1                        :    out std_logic;
  Int_Fpga_Ack_2                        :    out std_logic;

 

2. In customip.mpd file, I specified the signals as

 

  PORT Int_Fpga_Ack_1 = "", DIR = O, SIGIS = INTERRUPT, SENSITIVITY = EDGE_RISING, INTERRUPT_PRIORITY =   MEDIUM

  PORT Int_Fpga_Ack_2 = "", DIR = O, SIGIS = INTERRUPT, SENSITIVITY = EDGE_RISING, INTERRUPT_PRIORITY =   MEDIUM

 

3. In Ports tab, I connected these signals to microblaze_0_intc.

 

Software side, Idid the following things:

 

4. My Interrupt handler routines:

 

  void intr_mem_up()
{
    xil_printf("\n\r INTERRUPT 1 REGISTERED\n\r");
}

void intr_mem_low()
{
    xil_printf("\n\r INTERRUPT 2 REGISTERED\n\r");
}

 

5. In main() function,

 

  microblaze_enable_interrupts();


  XIntc_RegisterHandler(XPAR_MICROBLAZE_0_INTC_BASEADDR,

     XPAR_INTC_0_VOICE_DATA_IP_0_INT_FPGA_ACK_1_VEC_ID,
     (XInterruptHandler)intr_mem_up, (void*)XPAR_MICROBLAZE_0_INTC_BASEADDR);


  XIntc_RegisterHandler(XPAR_MICROBLAZE_0_INTC_BASEADDR,

    XPAR_INTC_0_VOICE_DATA_IP_0_INT_FPGA_ACK_2_VEC_ID,
    (XInterruptHandler)intr_mem_low, (void*)XPAR_MICROBLAZE_0_INTC_BASEADDR);
  
  XIntc_MasterEnable(XPAR_MICROBLAZE_0_INTC_BASEADDR);

  XIntc_EnableIntr(XPAR_MICROBLAZE_0_INTC_BASEADDR, XPAR_VOICE_DATA_IP_0_INT_FPGA_ACK_1_MASK |

      XPAR_VOICE_DATA_IP_0_INT_FPGA_ACK_2_MASK);
  

My application is getting hanged at XIntc_EnableIntr. When I'm commenting this line, application is not getting hanged.

 

I'm not sure how to resolve this issue.

I have attached system.mhs file for more reference.

 

Any help will be appreciated.

 

Thanks,

 

mayankara

0 Kudos
2 Replies
Professor
Professor
7,375 Views
Registered: ‎08-14-2007

Re: Application getting hanged while enabling interrupts for custom ip

It's generally a bad idea to print from an interrupt handler.  Depending on the implementation, it could hang the program or just cause strange interleaved output.  How did you determine where the program hanged?  If I had to guess it's actually in the interrupt handler and not in the interrupt enable block.  If you are debugging with printout, there is the possibility that the program itself is not hanged, but the output is broken because the the attempt to print during the interrupt handling.  I'd suggest trying to change the handler to just set a flag (global static variable) and have the main program check the flag and print a message (and then clear the flag) when it sees that the flag has become set.  This would tell you if the problem is really in the interrupt handler.

-- Gabor
0 Kudos
Highlighted
Contributor
Contributor
7,367 Views
Registered: ‎10-07-2014

Re: Application getting hanged while enabling interrupts for custom ip

Hi gszakacs,

 

I was checking value of IER offset by storing it in a variable.

IER register value after commenting xintc_enable line was 0x000c (since my data width = 32 & two interrupts refer to ethernet & timer interrupts). Even after uncommenting the line, value is 0x000c (means custom ip interrupts did not get enabled) rather than 0x000f. 

After uncommenting the line, application got hanged. Print statements within handlers are just for checking whether interrupts got enabled or not.

Is it correct method to directly write to IER register?

Can you suggest something how to resolve the issue.

 

Rgds

0 Kudos