Solved

Interrupt on PPC440 with a custom IP problem

Posted on 2011-03-04
3
806 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:DBTechnique
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 

Author Comment

by:DBTechnique
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;

//----------------------------------------------------
// INTERRUPT HANDLER FUNCTION
//----------------------------------------------------
//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");
}

//----------------------------------------------------
// 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 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
   MY_TIMER_EnableInterrupt(my_timer_p);
   xil_printf("  - Enabling XPS timer\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);

   //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));
  }
}

0
 

Accepted Solution

by:
DBTechnique earned 0 total points
ID: 35085117
i found out
0
 

Author Closing Comment

by:DBTechnique
ID: 35085123
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);
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Configuring Remote Assistance for use with SCCM
Check out this step-by-step guide for asking an anonymous question on Experts Exchange.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

751 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