An FPGA Tutorial using the ZedBoard

This tutorial is intended as a simple introduction to FPGAs using the Xilinx ZYNQ SoC FPGA. The board used in the examples is the ZedBoard, but you could use pretty much any ZYNQ development board that supports Pmod interfaces. The tutorial uses the Digilent PmodENC and PmodSSD peripheral boards. Links to these products are provided below. You can find out about the ZedBoard at http://www.zedboard.org.

Supplies

You can purchase a ZedBoard from Avnet Express for $395, or from Digilent for $495 ($319 Academic). A good alternative board for this tutorial is the ZYBO board (also from Digilent). It is $189 ($125 Academic). The main difference between the boards is that the ZedBoard has an FMC expansion connector and a more powerful FPGA. This tutorial will also uses two Digilent Pmod boards. The PmodENC rotary encoder and the PmodSSD seven segment display.

Software

You can follow along with the tutorial using either Linux or Windows. I use Linux so the examples may be biased in that direction. However, I will also try to provide links and tips for using Windows.

You will need to download the Xilinx Vivado software from the Xilinx website. Make sure you download release 2014.4 or later. The ZedBoard comes with a license for the ZYNQ 7020 part on the board. Follow the directions that come with the board to redeem your license.

But First..

Before starting on this tutorial, you should do the first tutorial on the ZedBoard site. That will get you familiar with using the Vivado IDE. Specifically you need to learn how to create a project and program the board. Once you have mastered that, you can get started on the tutorials here.

36 thoughts on “An FPGA Tutorial using the ZedBoard

  1. Pingback: LEON3 | gumdaeng

  2. Pingback: Running LEON3 on ZedBoard Tutorial | gumdaeng

  3. Pingback: FPGA (ZedBoard) with Verilog, High Level Synthesis, and Model-Based Design, Simplest Examples – tranminhhai

  4. Hello,
    I am working on zynq zc702.so how to generate a FPGA core with ARM and spi peripherals and talk with outside world and see the clock and data bits are toggle.
    2} How to do a communication between ARM and FPGA using SPI interface.

    Thanks
    Deepak

  5. I think if you follow the tutorial you will learn how to do this. While the tutorial doesn’t cover SPI specifically but rather I2S for audio the principal is the same.

  6. Hi pete,
    Can you give me some suggestions using SPI how to do accordingly i will proceed.

    Thanks

  7. Tutorial 15 describes connecting the ARM processor to your RTL code. The later tutorials on I2S show how to design a serial interface which is very similar to SPI. You just need to combine these techniques to make a SPI interface. It would have registers to control the data you want to send or read the data you have received. In addition you would need some control registers to start the transmission and control various aspects of your logic – like the SPI clock rate for example. Have you worked through all the tutorials? It is important to really understand what you are doing. Otherwise you will always be limited to using only the Xilinx IP or things you can copy from others. And when something goes wrong you won’t have any understanding of how to fix it.

  8. Hello,
    I gone through tutorials butn i tried to design the same block in vivado as shown in tutorials for I2S but i am not able to do the same in vivado 2015.4 and i am using zynq zc702 board.so please can you suggest me how to design a block for I2S.

    Thanks

  9. The ZC702 does not have any I2S as far as I know. But I thought you wanted a SPI interface. I am not sure why the tutorials would not work in Vivado 2015.4 but I have not tested them with that release. Can you give more information about what doesn’t work? It is hard to give you more advice on your SPI interface without knowing what your requirements are. Maybe you could use the onboard SPI that comes with the ARM and configure that for your needs? Otherwise you will have to write some RTL code to implement the SPI interface.

  10. Hello,
    Actually i have to create a FPGA core with ARM and SPI peripherals and talk with outside world by just hooking out pins to scope and seeing clock and data bits are toggles.How to do this any suggestions?

    Thanks

  11. Hello,
    I want to use the SPI peripheral in ARM to program the control the ADC, DAC and clock synthesizer on your board.
    The ADC, DAC and clock synthesize are SPI slave peripherals. So the SPI in ARM as has to operate as master. so how to do this any suggestions?

    Thanks

  12. I’m not sure what you mean by “my board”. The ZC702? If you make an FPGA with an ARM core like I show in the tutorial you can configure the built-in SPI interfaces for the ARM. You can then use them from software on the ARM. I have a customer right now that may need help doing this as well. If I need to help them with it then I can offer more specific help to you or write a blog post about it. But for now there is not much more that I can do to help.

  13. Hi Pete,
    I have a project with ZedBoard for my final year project.
    As the big picture of it, I need to fetch data from Digilent’s PModGPS, and then the data will be modulated by FSK modulation in the PL. The modulated signal is then sent to the Line Out port of the zedboard.
    Can you please give me some ideas on how to imoplement this? I’m using Vivado.

    Thanks in advance Pete

  14. The PModGPS provides a serial data stream. I am assuming that you will transmit the line out signal over some type of RF link and then convert it back on the receiving end. My guess is that you would design your FSK block to take the serial data and encode it and using an AXI streaming interface. You need to make sure that the rate out of your FSK block matches the rate in for the I2S transmit unit. It should be pretty straightforward. Let me know if you have more questions.

  15. Hi Pete,

    It’s really great tutorial for a newbie in ARM+FPGA. I am starting to learn how to use the Zedboard manufactured by Diligent. Inc. You have mentioned in the blog that it would be better to go through the first tutorial of the Zedboard. I am not sure which tutorial you suggest. Could you please specify more on the pre-tutorial?

    The second question is which version of the Vivado you recommend to use for the tutorial?

    Thanks in advance.

    Alex

  16. Hi Pete,

    Sorry to bother here. I am trying to leave a comment. But it seems keep failing in the first several tries. So I am simplifying my questions here

    Q1: which version of Vivado you recommend to use to go through the tutorial? As you mentioned above Vivado 2014.4 or later would be fine, I am wondering which version you use to save the time for debugging caused by the version problem.

    Q2: You suggest for the new beginner to have a look at the first tutorial of the Zedboard, Could you please specify it more?

    Thanks in advance.

    Alex

  17. I did the tutorial with 2014.4. But you may want to try 2016.1. Expect things to look a little different. You don’t need to do the ZedBoard tutorial first unless you have no idea at all what you are doing. My first tutorial is pretty basic. But it doesn’t cover things like installing tools or starting them up.

  18. Pingback: An FPGA Tutorial using the ZedBoard | Beyond Circuits - TrostelTech

  19. Hello Pete Johnson,

    Can we use this tutorials for MicroZED Board. I have not yet started this tutorials and just going through the ZedBoard site. I am getting familiar with the Vivado IDE to create a project and program the board.

  20. Yes, you can do many of these tutorials with the micro zed. You will need to change the pin assignment constraints but that is pretty simple. The tutorials cover using the board schematics to figure out the pin assignments. Some of the later tutorials use audio and that won’t work on the micro zed.

  21. Dear sir,
    I am very thankful for your tutorials which helped me a lot; however, I still have a lot of questions especially with the basics, so, I hope you can help me.
    1- I have a zedboard with yocto installed on sdcard, and i want to attach an spi temperature sensor to the arm and read its data without passing through vivado and fpga, can I do that? if not, what is the easiate way to read data from the spi sensor as I am a newbie in the fpga world and yocto.
    2- Can you write a tutorial on how to setup yocto for zedboard?
    3- Any idea on how to use dma on yocto with vivado?
    Thanks in advanced

  22. As for your first question, no, you can’t access SPI without an FPGA program. You need to do some configuration with Vivado to configure the ARM. So even if you use the SPI interface on the processor subsystem you will still need to use Vivado.
    For your second question, I have not used Yocto. I have used Petalinux which is supported by Xilinx and have some tutorials on that. I have not used DMA with Linux yet, but I don’t think it should be too difficult. You basically set up a DMA controller inside the FPGA. Usually that connects to a streaming interface. I am not sure what the Linux driver side looks like but it is a pretty common thing to do so there should not be a lot of things you would need to invent.

    -Pete

  23. Thanks for your answers.
    Can you write a tutorial on how to setup yocto for zedboard? as yocto become more popular and lot of people prefer open source, focusing on how to deal with fpga, spi, i2c, and dma?

  24. Petalinux is open source. Given Xilinx’ support for Petalinux that is the option that I and my customers have chosen. I am pretty sure that from a functional perspective once you have a running Linux all of the things you are looking for would function the same between Petalinux and Yocto. So, unless something comes along that requires me to use Yocto I won’t be doing any tutorials on it.

  25. hi to every one..
    I am rajasekhar new to the zedboard ,but i want to do the PMOD ADC on ZEDboard.
    can i anyone suggests the required tutorials and documentation for it.

  26. Hello,
    Does any know how to work on Uartps interrupt,
    I referred example on interrupt in SDK installation folder, I copy as it is, but it is not working
    can i anyone suggests the required tutorials and documentation for it.

  27. Hello everyone,

    I am working on a project involving interfacing an external ADC with the zedboard using PMOD.
    So generally I want to read the digital data and then send these to the FMC.
    It would be great if anyone can suggest ideas of how to implement it.

    Thanks in advance.

  28. It really depends on the interface the ADC uses. Since PMOD doesn’t have very many pins I would guess you are using SPI or I2C. Which ADC are you using? Are you purchasing the ADC board or are you making your own? For SPI and I2C you can just connect the ARM processor subsystem to your device. You need to map to the appropriate pins on the FPGA though. Or do you need to process the data first in the FPGA fabric? You really need to give more information before anyone can really answer.

    -Pete

  29. Can anyone give the verilog code and. Xdc file for 4bit parallel to serial converter using switches and serial data is shown on any one led on zedboard

    Please reply

  30. What you are asking is pretty ambiguous. But I am sure that if you follow along with the first few tutorials you will gain enough understanding to accomplish what you want.

    -Pete

  31. That’s actually a more difficult question than you might think. I first started coding Verilog for RTL synthesis in 1993. So my path towards understanding the subject is very different than the path one would take today. So I will answer a different question. What do I think someone today should do to become an expert with FPGA design.

    FPGA design is an extremely broad subject. There is no one place you can go to teach you everything you need to know. You need to become an expert on a couple different subjects. The first is system architecture and logic design. The logic design part is knowing how to implement an algorithm in a logic circuit. Most of the tutorials here just touch on the beginnings of this subject. I am not familiar enough with the current textbooks on this subject to recommend one. But you should be able to find a course in the subject at a nearby university. Or maybe you can find out which books are used by some major universities on the subject. My local university is UC Santa Cruz. Here is a link to their logic design class https://classes.soe.ucsc.edu/cmpe100/Fall17/. They use the textbook Fundamentals of Digital Logic with Verilog Design https://www.amazon.com/Fundamentals-Digital-Logic-Verilog-Design/dp/0073380547. The book is quite expensive though. I am sure you can acquire the knowledge in other ways.

    You should also think up some fun project you would like to do to practice with and direct some of your learning. There seem to be a lot of vintage computer FPGA projects right now. This might be a good way to learn about logic design and system architecture by studying some architectures from simpler times.

    It is also a MUST to become expert with FPGA verification. This is pretty much an entirely different subject. You may use SystemVerilog for RTL design and for Verification, but there is little overlap between the different aspects of the one language. Again, I don’t have any good books on the subject to recommend. But I am sure there are a bunch out there. You will find a lot on UVM and that is a great thing. But don’t focus on UVM at first. That will only add complexity. What you want is to be comfortable with writing tests and simulating your designs. You should spend at least as much time writing verification code as you do RTL. If you are doing it right you will probably spend more time on verification than on RTL coding.

    I cannot stress this enough. Many FPGA designers will tell you that simulation is a waste of time. I guarantee you these people are wrong and further they write bad code. Writing code is like writing English prose. They both involve editing. Revising. Making changes to clarify and simplify. In coding terms we call this refactoring. You write something. Then you go back over later and revise and improve it.

    Engineers that don’t properly verify their code in simulation are afraid to touch code they feel is working. This is because they have no regression testing. It requires manual effort to run all the testing they have done before. As a result, they only patch their code. When they add features they touch as little as possible. Imagine a writer that has never revised anything he has written. Would you want to read their book?

    If you have a good verification suite for your FPGA and you are confident that any RTL code which passes the suite of tests will work then you will make changes with abandon. You will look at code and say “I can make that simpler”. Or “I can rewrite the way this works to add a new feature”. In the process of editing your code and simplifying it you will learn to write better code. You will write more good code right out the gate.

    Sorry if that sounds like a bit of a rant. But really, I am working on a project right now which involves refactoring a bunch of code where the original engineers never simulated. I literally replaced 140 lines of code with a single “+” operator. I am sure their argument for the original code was “it worked, so we didn’t want to change it”.

    So this post has gotten pretty long. Sorry about that.

    -Pete

    TLDR; Read a book on logic design or take a class. Ditto for verification. Find a fun project. Explore. Ask questions. ALWAYS simulate.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.