Cmod A7 Programming Guide
There are two ways you can program the Cmod A7:
- Quad SPI Flash
This tutorial will walk you through what you need to know to get started on your projects and program your Cmod A7 FPGA board using each of the two possible methods. It is recommended that you first complete the “Getting Started with Vivado” guide before continuing with this project.
- Basic familiarity with Vivado
- This experience can be found by walking through our “Getting Started with Vivado” guide
- Cmod A7 FPGA board
- Micro-USB cable
- Vivado Design Suite 2015.X
- This proccess will work for 2016.X editions of Vivado as well
Board Support Files
- Cmod A7 Support Files
- These files will describe GPIO interfaces on your board and make it easier to select your FPGA board and add GPIO IP blocks.
- Follow the Wiki guide: Vivado Board Files for Digilent 7-Series FPGA Boards on how to install Board Support Files for Vivado.
Source Files – ZIP
1. Creating the Project
First we will need to create a project.
1.1) Open up Vivado and click “Create New Project” to open Vivado's New Project wizard.
1.3) We will be building this project from the ground up and adding our own sources so we will want to create an RTL project. select RTL Project and click “Next”.
1.4) In this window, you can select any source files or directories that you'll want to use in your projects. We can also select which language we'll be programming in. For this project just keep the default settings. Create a new file by clicking the Create File button.
Find “btn_led.v” within the source files folder you downloaded and click Ok.
The “Copy sources into project” checkbox will be enabled by default. This creates another “btn_led.v” within our project directory so that the original will not be altered.
Click “Next” to continue.
1.5) This window lets you choose existing IP (Intellectual Property) cores if you have them, but for this tutorial no IP's will be necessary. Click “Next”.
1.6) This is where we'll import our Xilinx Design Constraints file (XDC) to map the HDL signals to the Artix-7 pins. Click Add Files, navigate to where you saved your CmodA7_B.xdc file, select it, and click “Next”.
1.7) At this point Vivado will open up a part selection window. Select the “Boards” tab highlighted in orange below. If you installed the board files correctly, you should see a list of Digilent boards. Select the Cmod A7 and click “Next”.
This will create your project and bring you to the Vivado project manager.
You have now successfully created/imported your program files and configured your project to properly communicate with the Cmod A7.
2. Creating Program File
For the two ways to program your Cmod A7 FPGA there are two associated file types available; .bit and .bin files. Using a .bit file we can use either the JTAG programming cable, or a standard USB storage device to load the bit file into the FPGA. Programming with a .bin file will use the QuadSPI to program the FPGA each time it is powered on. This means you will not have to reprogram it each time via a micro USB cable or by a thumb drive. The following steps bellow will get you all prepared to program your Cmod A7.
2.1) In order to program the FPGA on startup we have to specify that we want to generate a .bin file. This can be done by clicking Tools> Project Settings> Bitstream. In this window we will check the box next to .bin_file. Now Vivado will create both a .bit, and .bin file when we generate a Bitstream. Click Ok.
2.2) To begin, we will run the synthesis by clicking “Run Synthesis” beneath Synthesis in the Flow Navigator on the left side of Vivado.
2.3) When the program finishes synthesizing your project, you will see the Synthesis Completed window below. Click “Open Synthesized Design” and then press Ok.
2.4) You should now see your Synthesized Design in the window to the right. It should look like this:
2.6) Under Configuration, set Configuration Rate (Mhz) to 33.
2.7) Under Configuration Modes, select Master SPI x4
2.8) Press “Ok”, save your synthesized design (Ctrl+S). Vivado will notify you that since you have changed some things after synthesizing your design, your synthesis may become “out of date” with respect to your current project; go ahead and click Ok anyway. Vivado will then ask where you want to write unsaved constraints (even though we did not change any constaints); go ahead an choose the existing file that was used with this project and click Ok. Then click “Generate Bitstream” in the Flow Navigator on the left side.
2.9) This will open a box stating that you have not implemented your design. Click “Ok”.
2.10) Vivado will begin generating your bit and bin files. When completed Vivado will show you this box. Feel free to select “Open Implemented Design”, or “View Reports” but you can also just cancel to continue with the guide.
At this point you have successfully created a .bit and .bin file that are ready to program the Cmod A7. As said previously there are two ways to program the Cmod A7 FPGA board, and we will be walking through each one of them below.
3. Programming the Cmod A7 using JTAG
JTAG is primarily used as a programming, debugging, and probing port and communicates through the micro-USB port. This makes interfacing with the Cmod A7 easy because the micro-USB connection both supplies power to your board, and the ability to program it.
3.1) First, make sure that the Cmod A7 is plugged into your computer via micro-USB cord. Once the board is plugged in you should see something like this.
This will program your Cmod A7 through the JTAG connector. Once the programming window is closed go ahead and test out your board. Each slide switch at the bottom of your board should now toggle its respective LED on and off.
4. Programming the Cmod A7 using Quad SPI
Quad SPI Flash is a non-volatile memory that the Cmod A7's FPGA chip looks at on every startup. If Quad SPI is flashed then the FPGA will program itself with the contents found in Quad SPI's flash memory. This method of programming your board is great when you have a final project that you would like to demo or display that doesn't need to be edited and therefore reprogrammed.
4.1) In the Hardware Manager window, under hardware right click your device and click Add Configuration Memory Device…
4.2) This window will pop up. Select the n25q32-3.3v-spix1_x2_x4 (highlighted below). Click OK on the next window asking if you want to program the configuration memory device.
4.3) Select the .bin file (found in your project/project.runs/impl_1/ folder) where it asks for a configuration file and finally click OK.
Vivado will now erase the old configuration file, and reprogram your Cmod A7 with the demo file. From now on, when you power up the Cmod A7, the demo will load at startup until you reprogram it.