Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Regular Contributor
david_durand7@yahoo.fr
Posts: 78
Registered: ‎10-15-2010
0
Accepted Solution

Interrupt on PPC440 with a custom IP problem

Hi,

 

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 (http://www.fpgadeveloper.com/2008/10/timer-with-interrupts.html) 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
    XExc_Init();


    // 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");
    XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, XPAR_XPS_INTC_0_CUSTOM_READ_FIFO_0_IP2INTC_IRPT_INTR, (XInterruptHandler)CUSTOM_READ_FIFO_Intr_Handler, (void *)XPAR_CUSTOM_READ_FIFO_0_BASEADDR);


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


    // Enable Switch Debouncer interrupt requests in the XPS Interrupt Controller
    XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, XPAR_CUSTOM_READ_FIFO_0_IP2INTC_IRPT_MASK);


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


    // Enable PowerPC non-critical (external) interrupts
    XExc_mEnableExceptions(XEXC_NON_CRITICAL);

 

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

Regular Contributor
david_durand7@yahoo.fr
Posts: 78
Registered: ‎10-15-2010
0

Re: Interrupt on PPC440 with a custom IP problem

Just to add an information, if i comment the line :

XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, XPAR_CUSTOM_READ_FIFO_0_IP2INTC_IRPT_MASK);

 

the intterrupt still doesn't work but i can connect by lan and the LWIP tcp_accept is working

Super Contributor
lockiegrogan
Posts: 217
Registered: ‎01-25-2008
0

Re: Interrupt on PPC440 with a custom IP problem

Hi,

 

You need to call XIntc_Connect(....)

 

Lachlan.

Regular Contributor
david_durand7@yahoo.fr
Posts: 78
Registered: ‎10-15-2010
0

Re: Interrupt on PPC440 with a custom IP problem

Thanks for your answer.

 

Do i have to add the XIntc_Connect(....) or replace a previous line by it ?

 

Actually on the internet i found several different ways to use interrupt, but i'm not able to get at least one to work.

Can you tell me exactly the rigth sequence that i have to do in order  to use interrupt please.

Regular Contributor
david_durand7@yahoo.fr
Posts: 78
Registered: ‎10-15-2010
0

Re: Interrupt on PPC440 with a custom IP problem

[ Edited ]

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;

//----------------------------------------------------
// INTERRUPT HANDLER FUNCTION
//----------------------------------------------------
void MY_TIMER_Intr_Handler(void * baseaddr_p)
{
    xil_printf("  - timer Interrupt is working !!!!!!!!!!!!!!!!!!!!\r\n");
}

//----------------------------------------------------
// MAIN FUNCTION
//----------------------------------------------------
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 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");

 

   // Start the interrupt controller
    XIntc_mMasterEnable(XPAR_MY_TIMER_0_BASEADDR);
    XIntc_mEnableIntr(XPAR_MY_TIMER_0_BASEADDR, XPAR_MY_TIMER_0_IP2INTC_IRPT_MASK);


    //Enable the interrupt for the MY_TIMER device
   MY_TIMER_EnableInterrupt(my_timer_p);
   xil_printf("  - Enabling XPS timer\r\n");

   //Initialize the PPC440 exception table
   XExc_Init();
   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
   XExc_mEnableExceptions(XEXC_NON_CRITICAL);
   xil_printf("  - Enabling XPS enable exeption\r\n");
    
    //----------------------------------------------------
    // INITIALIZE THE TIMER PERIPHERAL
    //----------------------------------------------------
    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);

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

Regular Contributor
david_durand7@yahoo.fr
Posts: 78
Registered: ‎10-15-2010
0

Re: Interrupt on PPC440 with a custom IP problem

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

   // Start the interrupt controller
    XIntc_mMasterEnable(XPAR_MY_TIMER_0_BASEADDR);
    XIntc_mEnableIntr(XPAR_MY_TIMER_0_BASEADDR, XPAR_MY_TIMER_0_IP2INTC_IRPT_MASK);

 

by

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