Zybo Z7 XADC Demo


Description

This simple XADC demo is a Verilog project made to demonstrate usage of the Analog to Digital Converter hardware present within the Zybo Z7's Zynq chip.

  • An XADC IP core is used to read the voltage differences of each of the four vertical pairs of pins - channels - of the XADC Pmod Port.
  • The LED associated with a channel brightens as that channel's voltage increases.

Inventory


Download and Usage Instructions

First and foremost, releases - consisting of a set of files for download - are only compatible with a specific version of the Xilinx tools, as specified in the name of the release (referred to as a release tag). In addition, releases are only compatible with the specified variant of the board. For example, a release tagged “20/DMA/2020.1” for the Zybo Z7 is only to be used with the -20 variant of the board and Vivado 2020.1.

The latest release version for this demo is highlighted in green.

Note: Releases for FPGA demos from before 2020.1 used a different git structure, and used a different release tag naming scheme.

Board Variant Release Tag Release Downloads Setup Instructions
Zybo Z7-10 10/XADC/2022.1-1 Zybo-Z7-10-XADC-hw.xpr.zip See Using the Latest Release, below
Zybo Z7-20 20/XADC/2022.1-1 Zybo-Z7-20-XADC-hw.xpr.zip See Using the Latest Release, below
Zybo Z7-10 10/XADC/2021.1-1 Zybo-Z7-10-XADC-hw.xpr.zip See Using the Latest Release, below
Zybo Z7-20 20/XADC/2021.1-1 Zybo-Z7-20-XADC-hw.xpr.zip See Using the Latest Release, below
Zybo Z7-20 20/XADC/2020.1-1 Zybo-Z7-20-XADC-hw.xpr.zip See Using the Latest Release, below
Zybo Z7-10 10/XADC/2020.1-1 Zybo-Z7-10-XADC-hw.xpr.zip See Using the Latest Release, below
Zybo Z7-20 v2018.2-1 Release ZIP Downloads v2018.2-1 Github README
Zybo Z7-10 v2018.2-1 Release ZIP Downloads v2018.2-1 Github README
Zybo Z7-20 v2016.4-1 Release ZIP Downloads Using Digilent Github Demo Projects
Zybo Z7-10 v2016.4-1 Release ZIP Downloads Using Digilent Github Demo Projects

Note for Advanced Users: GitHub sources for this demo can be found in the 10/XADC/master and 20/XADC/master branches of the Zybo-Z7 repository. Further documentation on the structure of this repository can be found on this wiki's Digilent FPGA Demo Git Repositories page.


Instructions on the use of the latest release can be found in this dropdown:

Using the Latest Release

Note: This workflow is common across many Digilent FPGA demos. Screenshots may not match the demo you are working with.

Important: These steps are only to be used with releases for Xilinx tools versions 2020.1 and newer. Older releases may require other flows, as noted in the table of releases.

First, download and extract the '*.xpr.zip' file from the demo release, linked above.


Open a Vivado Project from a Release
Launch Vivado

Select the dropdown corresponding to your operating system, below.

Windows

Open Vivado through the start menu or desktop shortcut created during the installation process.

Linux

Open a terminal, and change directory (cd) to a folder where log files for your Vivado session can be placed, then run the following commands:

source <install_path>/Vivado/<version>/settings64.sh
vivado


In Vivado's welcome screen, use the Open Project button to navigate to and open the XPR file contained in the folder the release was extracted into.


Build a Vivado Project

Note that if your project already has a generated bitstream, as indicated by the status in the top right corner of the window reading “write_bitstream Complete!”, then you can skip this section.

Generate a Bitstream

In order to create a file that can be used to program the target board, each stage of the “compilation pipeline” needs to be run.

This starts with Synthesis. Synthesis creates a description of the logic gates and connections between them required to perform the functionality described by the HDL files, given the constraints included in XDC files. To run Synthesis click either in the toolbar or in the Flow Navigator. The output of Synthesis is then passed to Implementation.

Implementation has several steps. The steps that are always run are Opt Design (Optimize the design to fit on the target FPGA), Place Design (Lay out the design in the target FPGA fabric), and Route Design (Route signals through the fabric). To run Implementation click either in the toolbar or in the Flow Navigator. This output is then passed on to the Bitstream Generator.

The Bitstream Generator generates the final output file needed for programming the FPGA. To run Bitstream Generation click either in the toolbar or in the Flow Navigator. With no settings changed, the generator will create a '.bit' file.

Depending on the complexity of the design, the board used, and the strength of your computer, the process of building the project can take between 5 and 60 minutes. When complete, a pop-up dialog will appear, prompting you to select one of several options. None are relevant for the purposes of this guide, so click Cancel. The “write_bitstream complete” status message can be seen in the top right corner of the window, indicating that the demo is ready to be deployed to your board.


Set up the Zybo Z7

In order to use the demo, you will need to connect a circuit to the XADC Pmod Port in order to measure a voltage. The following example shows a voltage divider that produces each voltage between 0 V and 1 V in increments of 0.33 V. This circuit uses a chain of three 1 kΩ resistors in series with a 4.7 kΩ and a 2.2 kΩ resistor. The circuit is tied to the 3V3 and GND pins of the XADC Pmod header to provide power. Each of the 'n' pins, the lower row of the XADC port, are connected to ground.

Important

Voltages to be measured should be in the range of 0 to 1.0 Volts.


Program a Bitstream onto an FPGA Board

Vivado's Hardware Manager can be opened by clicking on Open Hardware Manager at the bottom of the Flow Navigator pane on the left side of the Vivado window.

The first step to programming a device is to connect the Vivado Hardware Server to it as a target. To get to the Open Hardware Target wizard click the link in the green banner near the top of the window. From the drop-down that opens, select .

Once the wizard opens, click Next.


The next screen asks if the hardware server is local or remote. If the board is connected to the host computer choose local, if it is connected to another machine choose remote and fill in the Host Name and Port fields.

Click Next to continue.


This screen gives a list of devices connected to the hardware server. If there is only one connected it will be the only device shown.

Click Next to continue.


The final screen shows a summary of the options selected in the wizard. Verify the information and click Finish. The board is now connected to the hardware server.


To program the device with the bit file generated earlier, either click the link in the green banner at the top of the window or click the button in the Flow Navigator under . From the drop-down that opens, select the device to program (Example: ) and the following window will open:

The Bitstream File field should be automatically filled in with the bit file generated earlier. If not, click the button at the right end of the field and navigate to
<Project Directory>/<Project Name>.runs/impl_1/ and select the bit file (Example: ). Now click Program. This will connect to the board, clear the current configuration, and program it using the new bit file.


At this point, the demo is now running on your board. Refer to the Description section of this document for more information on what it does.


XADC Channels

Each analog input channel will control the brightness of an LED as shown in the following table:

Channel Name LED # Pmod Pin #s
AD14 LD0 1 & 7
AD7 LD1 2 & 8
AD15 LD2 3 & 9
AD6 LD3 4 & 10

Changing Voltages by reconfiguring the circuit while the demo is running is fine. If you built the example circuit shown in the “Using the Latest Release” section, above, feel free to move jumpers around to test out the different nodes of the voltage divider.

Additional Resources

All materials related to the use of the Zybo Z7 can be found on its Resource Center.

For a walkthrough of the process of creating a simple HDL project in Vivado, see Getting Started with Vivado for Hardware-Only Designs. Information on important parts of the GUI, and indirect discussion of the steps required to modify, rebuild, and run this demo in hardware can also be found here.

For technical support, please visit the FPGA section of the Digilent Forum.