element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development How to setup interrupts from custom IP
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 5 replies
  • Subscribers 316 subscribers
  • Views 894 views
  • Users 0 members are here
Related

How to setup interrupts from custom IP

Former Member
Former Member over 12 years ago

I have a custom FIFO design in the PL that generates an interrupt after collecting 512 samples. The interrupt is connected to axi_intc_0. I am using the following code to setup the device and interrupt system:

static XIntc fifoInstance;
#define FIFO_DEVICE_IDttXPAR_AXI_INTC_0_DEVICE_ID
#define FIFO_IRPT_INTRttXPAR_AXI_INTC_0_PIRDEMODULATOR_0_IRQ_FIFO_INTR


void fifo_isr()
{
tprint("Inside ISR
r");
}

main()
{
.
.
.

    XIntc_Config * ConfigPtr = XIntc_LookupConfig(FIFO_DEVICE_ID);
    int result = XIntc_Initialize(&fifoInstance,FIFO_DEVICE_ID);
    if (result == XST_SUCCESS)
            {
            tprint("Interrupt init Successfully
r");
            }
            else
            {
            tprint("Interrupts could not be init
r");
            }
    u8 mode = XIN_REAL_MODE;
    result = XIntc_Connect(&fifoInstance, FIFO_IRPT_INTR,
    tt  (XInterruptHandler) fifo_isr, &fifoInstance);
    if (result == XST_SUCCESS)
        {
        tprint("Interrupt Connected Successfully
r");
        }
        else
        {
        tprint("Interrupts could not be connected
r");
        }
    XIntc_Enable(&fifoInstance, FIFO_IRPT_INTR);
    result = XIntc_Start(&fifoInstance, mode);
    if (result == XST_SUCCESS)
            {
            tprint("Interrupt started Successfully
r");
            }
            else
            {
            tprint("Interrupts could not be started
r");
            }
while(1)
{
}
.
.
.

}


here is the output:
Interrupt init Successfully
Interrupt Connected Successfully
Interrupt started Successfully

But it never gets into the isr.

Can you please help me with this? TIA

  • Sign in to reply
  • Cancel
  • jamestkennedy
    0 jamestkennedy over 12 years ago

    Have you looked at AR# 51138?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jamestkennedy
    0 jamestkennedy over 12 years ago

    also look at ug585 and ds871. good luck, i'm with you, Jyotsna!
    for the PS we are using the GIC and Interrupt ID 91 to 84. but I see alternatives.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jamestkennedy
    0 jamestkennedy over 12 years ago

    AR# 50572 is a good reference as well.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago

    Thanks for the help, I can now service interrupts to the FIFO.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago

    hello,
    I have simple rtl in PL which raises an interrupt. I have written software application to connect interrupt controller and acknowledge interrupt.
    here is my code
    #include <stdio.h>
    #include "platform.h"
    #include "xil_types.h"
    #include "xparameters.h"
    #include "xil_io.h"
    #include "xil_exception.h"
    #include "xscugic.h"

    XScuGic InterruptController; /* Instance of the Interrupt Controller */
    static XScuGic_Config *GicConfig;/* The configuration parameters of the
    controller */
    static int InterruptFlag;
    #define XPAR_FABRIC_AXI_TIMER_0_INTERRUPT_INTR 91
    #define XPAR_AXI_TIMER_0_DEVICE_ID 0
    #define SCLR_FPGA_RST_CTRL_ADDR(XPS_SYS_CTRL_BASEADDR + 0x240)
    void Interrupt_Handler(void *baseaddr_p)
    {
    tprintf("r
    ");
    tprintf("r
    ");
    tprintf("*************************r
    ");
    tprintf(" Interrupt acknowledge
    r ");
            Xil_Out32(SLCR_FPGA_RST_CTRL_ADDR, 0xf);
    tprintf("*************************r
    ");
    tprintf("r
    ");
    tprintf("r
    ");
    tInterruptFlag = 1;
    }

    int SetUpInterruptSystem(XScuGic *XScuGicInstancePtr)
    {
    t/*
    t* Connect the interrupt controller interrupt handler to the hardware
    t* interrupt handling logic in the ARM processor.
    t*/
    tXil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
    t(Xil_ExceptionHandler) XScuGic_InterruptHandler,
    tXScuGicInstancePtr);
    t/*
    t* Enable interrupts in the ARM
    t*/
    tXil_ExceptionEnable();
    treturn 0;
    }
    int ScuGicInterrupt_Init()
    {
    tint Status;
    t/*
    t* Initialize the interrupt controller driver so that it is ready to
    t* use.
    t* */
            Xil_ExceptionInit();
    tGicConfig = XScuGic_LookupConfig(XPAR_PS7_SCUGIC_0_DEVICE_ID);
    tif (NULL == GicConfig) {
    treturn -1;
    t}
    tStatus = XScuGic_CfgInitialize(&InterruptController, GicConfig,
    tGicConfig->CpuBaseAddress);
    tif (Status != 0) {
    treturn -1;
    t}
    t/*
    t* Setup the Interrupt System
    t* */
    tStatus = SetUpInterruptSystem(&InterruptController);
    tif (Status != 0) {
    treturn -1;
    t}
    t/*
    t* Connect a device driver handler that will be called when an
    t* interrupt for the device occurs, the device driver handler performs
    t* the specific interrupt processing for the device
    t*/
    tStatus = XScuGic_Connect(&InterruptController,XPAR_FABRIC_AXI_TIMER_0_INTERRUPT_INTR,(Xil_ExceptionHandler)Interrupt
    ttt_Handler,(void *)&InterruptController);
    tif (Status != 0) {
    treturn -1;
    t}
    t/*
    t* Enable the interrupt for the device and then cause (simulate) an
    t* interrupt so the handlers will be called
    t*/
    tXScuGic_Enable(&InterruptController, XPAR_FABRIC_AXI_TIMER_0_INTERRUPT_INTR);
    treturn 0;
    }


    main()
    {
      int xStatus;
      int exit_flag;
      printf("##### Timer demo Starts #####
    r");
      printf("r
    ");
      init_platform();
       Xil_Out32(SLCR_FPGA_RST_CTRL_ADDR, 0x0);
        Xil_Out32(SLCR_FPGA_RST_CTRL_ADDR, 0xf);
        Xil_Out32(SLCR_FPGA_RST_CTRL_ADDR, 0x0);
      xStatus= ScuGicInterrupt_Init();
    tif(0 != xStatus)
    t{
    t  printf(" :( SCUGIC INIT FAILED
    r");
    t}

    texit_flag = 0;
    t
    twhile(exit_flag != 1)
    t{
    ttif(InterruptFlag)
    tt{
    tt InterruptFlag =  0;
    tt}
    ttelse
    tt{

    tt}

    t}
    t
    }

    everything is getting print except interrupt handler

    give me suggestion
    thank u

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube