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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Zynq: Custom IP IRQ
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dhmarinov
  • Date Created: 5 Mar 2019 9:21 AM Date Created
  • Views 3309 views
  • Likes 3 likes
  • Comments 3 comments
  • zynq
  • custom ip
  • interrupts
Related
Recommended

Zynq: Custom IP IRQ

dhmarinov
dhmarinov
5 Mar 2019

Hello there,

 

          Recently I had to work with the interrupt features of Zynq and encountered some challenges.

Thankfully I managed to solve them so I decided to share the information in case other people encounter the same issue.

I know there are a lot of tutorials out there that explain how the interrupts work and how to set them up,

however, most of them describe how to connect interrupt coming from Xilinx IP or from PS peripheral.

Unfortunately there are some things that are not that obvious when having an interrupt from a custom IP.

For this example the setup is very simple – the PS and a counter, which sends one 10ns pulse each second.

image

Packaging the IP

 

No matter what the IP is doing the most important thing when packaging is to declare the output pin as an interrupt.

This happens by right-clicking on the pin and interring it as interrupt.

 

image

 

Once this is done, the signal can be connected to the PS. If this step is skipped then the interrupt will not show in the xparameters.h,

which means that the user cannot include it in the IRQ functionality in the software part.  Therefore the IP has to be re-packaged.

image

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

 

Connecting to the GIC

 

I’m not going to describe how the interrupts work in detail, however, if you are interested, you can check out the following tutorial.

In an essence when configuring the GIC there is a lot of Xilinx defined code that can be reused, no matter where the IRQ comes from or what is it supposed to do.

In fact the most important piece of code is the XScuGic_Connect function.

image

This is used to connect the interrupt source to the GIC and the IRQ handler (i.e. the function that should be executed once the interrupt is received).

The first parameter is pointer to the GIC instance, the second is the ID of the IRQ source, the third is the handler and the fourth is a callback reference.

image

 

The problem I encountered here is the last parameter of the function. If you look through the above mentioned tutorial you will see that the argument is an instance of the peripheral (&my_Timer).

The problem is that such an instance does not exist if you have a custom IP. It took me a while to found out what to do. It turns out the answer is quite simple - put it to 0.

And it works!!!

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

I have included a screenshot of the code, but if you want to try it yourself, then you can fetch it from my Github.

 

image

 

Thanks for the attention and have fun!

  • Sign in to reply
Parents
  • Jonathan101
    Jonathan101 over 2 years ago

    Hi dhmarinov,

    Does the procedure you described is viable for Ultrascale+ ?

    I've noticed that I don't see the interrupt identifier on xparameters.h.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • Jonathan101
    Jonathan101 over 2 years ago

    Hi dhmarinov,

    Does the procedure you described is viable for Ultrascale+ ?

    I've noticed that I don't see the interrupt identifier on xparameters.h.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
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