Table of Contents
There are multiple ways to download a bitstream file to the Basys3 board. This tutorial will demonstrate several methods available to you.
- The [opencd.py Python script] (Digital Lab)
- Vivado Hardware Manager (Linux and Windows)
- Adept (Windows)
- Using OpenOCD manually
openocd.py
The easiest way to program the Basys3 board is to use the openocd.py
script that is included in your classroom repository startercode.
To conifgure your board simply run the following command from the directory where the bitfile is located:
python3 ../resources/openocd.py example.bit
Vivado Hardware Manager
The Vivado hardware manager can be used to configure and FPGA. The following example demonstrates how to do this in command line mode.
Create a tcl script such as the one listed below (named program.tcl
for this example).
You will need to change the name of the bitfile you want to configure (see the file basys3_explore.bit
)
open_hw_manager
connect_hw_server -url localhost:3121 -allow_non_jtag
current_hw_target [get_hw_targets */xilinx_tcf/Digilent/210183B03687A]
set_property PARAM.FREQUENCY 15000000 [get_hw_targets */xilinx_tcf/Digilent/210183B03687A]
open_hw_target
current_hw_device [get_hw_devices xc7a35t_0]
refresh_hw_device -update_hw_probes false [lindex [get_hw_devices xc7a35t_0] 0]
set_property PROGRAM.FILE {basys3_explore.bit} [get_hw_devices xc7a35t_0]
program_hw_devices [get_hw_devices xc7a35t_0]
refresh_hw_device [lindex [get_hw_devices xc7a35t_0] 0]
Run the following command on the terminal prompt:
vivado -mode batch -source program.tcl
Adept
This will show you how to download a bit file to the Basys 3 board by using the program called Adept.
NOTE: the instructions below may show an XC7A100T FPGA chip in some of the video or pictures. In your case you will see XC7A35T instead (your board uses a slightly different FPGA chip).
Here is an overview video:
Instructions
- First, check that your Basys 3 jumpers are correctly placed by following the Setting Jumpers on the Basys 3 Board tutorial.
- Plug in your Basys 3 board with a micro USB cable and turn it on.
- Open Adept, which can be found on the desktop.
- If you get an error that says “Initialization Failed” you forgot to turn on the Basys 3.
- If Basys 3 isn’t selected in the top right of the window, change it to select Basys 3.
- Click browse.
- Navigate to the bit file that you are going to download to the board. Select it and click open.
- Click program.
- Wait for the bit file to be programmed to the board!
- When it is done Adept will say Programming Successful at the bottom.
- The DONE LED on the board itself will also light up. Check for the LED being on the before proceeding.
You can select recent files with the file name drop down menu.
If Adept doesn’t recognize your board, make sure the Basys 3 board is turned on and plugged into your computer. Also check that the Auto Initialize SC checkbox is marked under Settings.
OpenOCD
Follow the instructions at: https://github.com/byu-cpe/BYU-Computing-Tutorials/wiki/Program-7-Series-FPGA-from-a-Mac-or-Linux-Without-Xilinx. It will show you how to program the board directly from your Mac (or any other machine that will run ‘openocd’).
When following the instructions at the link above, you won’t actually have a bitfile.
However, if you run the command to program the board: openocd -f 7series.txt
, it will still recognize the board but will then later fail to actually program it.
All you need initially is to confirm that it can see your FPGA board.
Here is a transcript of a successful run of openocd, showing that it recognized an FPGA board, but then later failed to program it due to a missing bitfile (and this will be adequate to demonstrate that it sees the board):
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 10000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
0362D093
Programming FPGA...
Error: couldn't stat() stopwatch_top.bit: No such file or directory
failed loading file stopwatch_top.bit to pld device 0
The key line in the transcript above is the one that starts with Info : JTAG tap: ...
. Note that it says that a device was found. The hex value for the found device may differ from yours but this shows it did find a device.