Interrupt on PPC440 with a custom IP problem

Posted on 2011-03-04
Last Modified: 2012-05-11


i'm trying to use interrupt with my cunstom IP.

My architecture is :

- PP440 master on PLB0, PPC400 slave on PLB1

- Central DMA master on PLB1, Central DMAslave on PLB0

- Custom IP slave on PLB1

- TEMAC, Uart, Timer, Xint slave on PLB0

- I also use the lwip library


I follow this tutorial ( to create a custom IP with interruption, just in my case the Custom IP VHDL code is a bit different since i don't need a timer.


After in XPS in order to setup the interuption i wrote this code (the code in the bellow tutorial seems to be for microblaze):


in my main before the while(1):

    // Initialize Interrupts on PowerPC

    // Register the interrupt handler of the XPS Interrupt Controller with the PowerPC's external interrupt.
    xil_printf("  - Enabling XPS interrupts\r\n");
    XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT, (XExceptionHandler)XIntc_DeviceInterruptHandler, (void *)XPAR_XPS_INTC_0_DEVICE_ID);

    // Register the Switch Debouncer interrupt handler in the vector table of the XPS Interrupt Controller
    xil_printf("  - Registering interrupt handler\r\n");

    // Start the XPS Interrupt Controller
    xil_printf("  - Enabling interrupts\r\n");

    // Enable Switch Debouncer interrupt requests in the XPS Interrupt Controller

    // Enable custom fifo read interrupts
    xil_printf("  - Enabling CUSTOM_READ_FIFO interrupts\r\n");

    // Enable PowerPC non-critical (external) interrupts


then the callback interrupt on another file :

void CUSTOM_READ_FIFO_Intr_Handler(void * baseaddr_p)
xil_printf("  - CUSTOM_READ_FIFO_Intr_Handler received \r\n");


The first problem is when i run this code (compile without error) i no more able to connect to the FPGA by LAN. i meen the callback function tcp_accept seems to not work anymore.


Can some could help me and give advice  ? does the interrupt setup is wrong ??


Thank you
Question by:DBTechnique
  • 3

Author Comment

ID: 35084763
Here is my new test with an example timer that i found on internet. If i check the value of the timer interrupt with the line xil_printf (on the while(1)) i can see on the uart that the value is 0 and then become 1 so the timer is working and his interrution too. But i still never go to the "void MY_TIMER_Intr_Handler(void * baseaddr_p)".
why? what did i miss on the setup ?
Please help me.

#include "xparameters.h"
#include "xbasic_types.h"
#include "xgpio.h"
#include "xstatus.h"
#include "my_timer.h"
#include "custom_read_fifo.h"
#include "xintc.h"
#include "xexception_l.h"

#define TIMER_RESET   0x00000000
#define TIMER_RUN     0x40000000
#define TIMER_EXPIRED 0x80000000
#define TIMER_HALFSEC 0x02FAF080

XIntc InterruptController;
Xuint32 my_timer;
unsigned int *my_timer_p = (unsigned int *) XPAR_MY_TIMER_0_BASEADDR;
//unsigned int *my_custom_read_fifo_p = (unsigned int *) XPAR_CUSTOM_READ_FIFO_0_BASEADDR;

//void CUSTOM_READ_FIFO_Intr_Handler(void * baseaddr_p)
//      xil_printf("  - fifo Interrupt is working !!!!!!!!!!!!!!!!!!!!\r\n");
void MY_TIMER_Intr_Handler(void * baseaddr_p)
      xil_printf("  - timer Interrupt is working !!!!!!!!!!!!!!!!!!!!\r\n");

int main (void)
      XStatus Result;
      //Initialize the interrupt controller driver so that it's ready to use.
   Result = XIntc_Initialize(&InterruptController, XPAR_XPS_INTC_0_DEVICE_ID);
   if (Result != XST_SUCCESS){return Result;}xil_printf("  - Enabling XPS initialize\r\n");
      //Perform a self-test to ensure that the hardware was built correctly.
   Result = XIntc_SelfTest(&InterruptController);
   if (Result != XST_SUCCESS){return Result;}xil_printf("  - Enabling XPS SelfTest\r\n");

//   //Register the handler for fifo
//   Result = XIntc_Connect(&InterruptController, XPAR_XPS_INTC_0_CUSTOM_READ_FIFO_0_IP2INTC_IRPT_INTR, (XInterruptHandler)CUSTOM_READ_FIFO_Intr_Handler, my_custom_read_fifo_p);
//   if (Result != XST_SUCCESS){return Result;}xil_printf("  - Enabling XPS connect fifo\r\n");
      //Register the handler for timer
   Result = XIntc_Connect(&InterruptController, XPAR_XPS_INTC_0_MY_TIMER_0_IP2INTC_IRPT_INTR, (XInterruptHandler)MY_TIMER_Intr_Handler, my_timer_p);
   if (Result != XST_SUCCESS){return Result;}xil_printf("  - Enabling XPS connect timer\r\n");
   //Start the interrupt controller so interrupts are enabled for all devices that cause interrupts.
   Result = XIntc_Start(&InterruptController, XIN_REAL_MODE);
   if (Result != XST_SUCCESS){return Result;}xil_printf("  - Enabling XPS start\r\n");

//      //Enable the interrupt for the CUSTOM_READ_FIFO device
//   CUSTOM_READ_FIFO_EnableInterrupt(my_custom_read_fifo_p);
//   xil_printf("  - Enabling XPS fifo\r\n");
      //Enable the interrupt for the MY_TIMER device
   xil_printf("  - Enabling XPS timer\r\n");

      // Start the interrupt controller

   //Initialize the PPC440 exception table
   xil_printf("  - Enabling XPS xexc init \r\n");

   //Register the interrupt controller handler with the exception table
   XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT, (XExceptionHandler)XIntc_InterruptHandler, &InterruptController);
      xil_printf("  - Enabling XPS handler exeption\r\n");

   //Enable non-critical exceptions
   xil_printf("  - Enabling XPS enable exeption\r\n");
      xil_printf("  - Initializing the timer peripheral\r\n");
      // Check that the my_timer peripheral exists
      XASSERT_NONVOID(my_timer_p != XNULL);
      my_timer = (Xuint32) my_timer_p;
      // Load the delay register with the delay time of 0.5s
      MY_TIMER_mWriteSlaveReg0(my_timer, 0, TIMER_HALFSEC);
      // Start the timer
      xil_printf("  - Starting the timer\r\n\r\n");
      MY_TIMER_mWriteSlaveReg1(my_timer, 0, TIMER_RUN);

      //xil_printf("Timer interrupt vslue : %d\r\n", MY_TIMER_mReadReg(my_timer, MY_TIMER_INTR_IPISR_OFFSET));


Accepted Solution

DBTechnique earned 0 total points
ID: 35085117
i found out

Author Closing Comment

ID: 35085123
i found out, if someone wants to know i just replace lines :

   // Start the interrupt controller



// Start the interrupt controller
    XIntc_Enable(&InterruptController, XPAR_XPS_INTC_0_DEVICE_ID);

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After-hours service is a fact of life for most MSPs. While not the most pleasant aspect of the job, there are ways to make after-hours servicing a more profitable and organized enterprise.
Read our guide on how to survive being on-call.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question