element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • 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
Path II Programmable
  • Challenges & Projects
  • Design Challenges
  • Path II Programmable
  • More
  • Cancel
Path II Programmable
Blog Path II Programmable Blog 10 - Project Part 1 - Exploring PYNQ with the Ultra96v2
  • Blog
  • Forum
  • Documents
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: avnrdf
  • Date Created: 27 Dec 2019 6:29 AM Date Created
  • Views 180 views
  • Likes 1 like
  • Comments 0 comments
  • ultra96-v2
  • path ii programmable
  • avnet
  • xilinx
  • pynq
Related
Recommended

Path II Programmable Blog 10 - Project Part 1 - Exploring PYNQ with the Ultra96v2

avnrdf
avnrdf
27 Dec 2019

The Path II Programmable training covered a great deal of Zynq MPSoC Hardware, Software and Petalinux content - covering almost everything required to build a Zynq MPSoC system: right from the logic running to the PL, to Petalinux and software applications that run on the PS. My plan was to work on a project that covered all of this, but this turned out to be more complicated that I originally thought it would be. To add to this, I've been very busy at work, so there have been a couple of weeks that have passed by without me doing anything related to PIIP.

 

While I won't be changing my project too much, I'm going to take the PYNQ route in hopes of finishing my project a little faster!

 

Setting up PYNQ on the Ultra96v2

 

I downloaded the PYNQ v2.4 pre-built image from https://github.com/Avnet/Ultra96-PYNQ/releases and flashed it to a SD card using Etcher. Connect a micro-USB cable to the 'USB 3 Device' header - the Ultra96 will enumerate as a COM port and Ethernet adapter. Navigate to 192.168.3.1 using a browser, and after logging in, you should see a Jupyter notebook:

 

The PYNQ image includes a couple of examples to demonstrate how to:

  • download an overlay to the PL, and also measure the time taken to download it.
  • get/set the fabric clocks generated by the PS
  • connect to a WiFi network
  • use a USB webcam

 

Creating PYNQ overlays

 

My plan for PYNQ is to use Python to talk to the custom logic that I've implemented in the PL. A lot of examples I've seen use pre-built overlays, but the first step for me is to learn how to import and use an overlay that has been generated by Vivado.

 

I followed this tutorial, and used the base vivado project from https://github.com/Avnet/Ultra96-PYNQ to ensure that my PS configuration would match what was used to build the PYNQ image.

The tutorial uses Vivado HLS to create an IP that adds 2 numbers - HLS generates the IP, and all you need to do is point Vivado to the IP, and add it to your block design.

 

After the bitstream has been generated, export the block diagram's tcl file, and bitstream. Copy both of these to the ultra96 and rename them so that both have the same filenames.

In PYNQ, import the overlay (which downloads it), import the IP created by Vivado HLS, write to 2 registers (which are the inputs), and read from the third, which will contain the output. To create a more formal 'driver', import the DefaultIP class, and add the 'add' function as a driver API.

 

Now that I was done with this example, I decided to add a couple of more things to the design. My Verilog & VHDL is a little rusty, so I grabbed the sources for the IP core that I used in Path to Programmable Blog 14 - Project: A MiniZed WS2812 Controller. However, instead of adding it as an IP, I added the source files to the current design, and imported it as a module. The top file follows the naming convention that Vivado uses, allowing the AXI port 'snapping' to work as usual, and the biggest advantage of using it as a module instead of an IP is that it's a lot easier to modify the source code.

 

I made a couple of changes to expose the BRAM ports from my original design (since it was internal to the IP), and added a dual port BRAM & AXI BRAM controller - allowing the BRAM to be accessed by my IP, as well as Python code running in the PYNQ environment. The 'mmio' class allows access to the system memory space, so I added some code that wrote to the BRAM and read it back to test things out.

 

Now that I've figured this out, it's time to move on to implementing the second half of the project - some custom RTL that allows me to capture I/O pin states to BRAM (like a logic analyzer), as well as drive the IO pins according to the data in the BRAM (i.e. a pattern generator).

Anonymous
Element14

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 © 2022 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube