2024T3 COMP3601 M1 Individual LED Start
2024T3 COMP3601 M1 Individual LED Start
Overview
Every student will receive a baseline FPGA project package consisting of:
● Pre-flashed Petalinux image with configured software and example bitstreams on SD card
● Kria KV260 and power supply, ethernet cable, USB cable
● UNSW CSE Design Project A/B PMOD board
● Adafruit I2S MEMS microphone (not used in this lab)
This guide describes the steps for students to program the KV260 board with some custom
hardware. Students are required to go through this tutorial. The diagram below is an overview of
the steps of development for the Kria platform. In this guide, we will be using Ubuntu Linux as
our OS running on the host machine. You can also use Windows.
The above diagram presents the overview of programming the Kria KV260 FPGA - it is a
relatively involved process! But for this simple LED we will just focus on activating FPGA
designs, then on generating the .bit file and programming the board over USB.
Prerequisites
The software you should have installed before starting:
● Vitis Vivado 2021.1
o During installation, you need to choose to install the full Vitis package as it will
be needed later in this course.
● If Ubuntu: minicom, if Windows: Putty
In the first part of this tutorial you will learn about and connect to the PetaLinux installation
which is on your Kria KV260.
Power up
1. Ensure your SD card is plugged in. This contains the PetaLinux boot files.
3. Connect the power cable to the FPGA and to the power. This will start the FPGA up. It
should look like something this, with all your setup done:
Open your serial port:
Ubuntu instructions:
After power up when connected to the Ubuntu PC via USB, the KV260 is usually connected to
/dev/ttyUSB1.
Use the arrow keys to go to “Serial port setup”, then press enter, then press “F” to turn Hardware
Flow Control to No
Then press “Escape” and press “Escape” again. The serial should now be opened. If instead an
error message shows up, ask a tutor for help on opening the connection to the board.
If it works, you should see something like this:
Windows instructions:
Open PuTTY and go to the terminal settings.
Enable Implicit CR in every LF
Implicit LF in every CR
Note there is often a long delay between the last OF message and the “Starting tcf-agent:” OK.
This terminal is the root login for PetaLinux running on the PS. Try out some linux commands:
In the PetaLinux image baked into the SD card, there are some FPGA designs already created
that can be downloaded from the PS to the PL.
1. Run xmutil listapps to list out the available hardware (your list may differ)
root@xilinx-k26-starterkit-2021_1:~# xmutil listapps
Graph-server: new client
Accelerator Base Type #slots Active_slot
3. Load the default COMP3601 “blink 3 times” LED project with xmutil loadapp
comp3601-led-blink3
4. This should make the LED blink 3 times and then pause on the extra PMOD board that you
plugged in.
3. Select RTL Project. We will add the sources later so tick Do not specify sources at this
time. Click Next.
4. In the Default Part section, click on the Boards tab and type "kv" in the search bar.
Select Kria KV260 Vision AI Starter Kit and click Next.
Make sure the Project part shows Kria KV260 Vision AI Starter Kit.
4. Click Add Files and Navigate to the kria-constraints.xdc file. Click Finish when done.
Adding a hardware file to the project
11. Finish the module using VHDL by implementing a clock divider/counter such that the
led_out will toggle every 1 second. (I.e., the LED will blink on/off with a period of 2
seconds).
1. You can search the internet for tutorial code to help you achieve this, but by the
end of this exercise you must be able to write this code using your own
knowledge. The Tutor will assess you on the functionality of your code so you
must be able to explain how it works.
(Optional) Add testbenches to the project
We provide you with a testbench file led_blinka_TB.vhd to simulate the behaviour of your
code. You could also write your own simulation testbench, but this will not be assessed in this
lab. Consult with your Tutor if you’d like to learn more about testbenches.
6. Set the Simulation top module name as led_blinka_TB.vhd or your own testbench file.
After applying the settings, you will expect to see the testbench file name bold under
Simulation Sources.
7. Click on Run Simulation in the Flow Navigator. Observe the behaviour of signals in your
design. The waveform should look something like this, if you let it run for 5 seconds.
Since the Kria KV260 has a processor system (PS) in conjunction with the FPGA programmable
logic (PL), we must also combine the PS with the PL in our design.
So, we need to add the Zynq MPSoC device and configure it for our hardware. To do this, we
will be using the IP INTEGRATOR tool.
1. In the Flow Navigator tab, click on Create Block Design under IP INTEGRATOR.
4. Click on Run Block Automation and click OK which will apply the Kria AI Starter Kit
preset to the Zynq device.
5. Right-click on the diagram and select Add Module.
8. Click on + to add another IP and search for “clocking wizard”. Double click to add the IP
to your block design.
9. Double click on the clocking wizard IP and navigate to the Output Clocks tab.
1. Set the clk_out1 clock to a requested 10MHz frequency.
2. Scroll down and under Enable Optional Inputs / Outputs for MMCM/PLL untick
the reset and locked ports.
3. Click OK to finish the configuration.
10. At this point your diagram should look something like this (block locations may vary):
11. Connect the ports of the clock output to the clock wizard input, and the clock wizard
output to the input of your LED module.
12. Double click on the Zync UltraSCALE+ block and go to PS-PL Configuration, then PS-
PL Interfaces > Master Interface and de-select the AXI HMP0 FPD and AXI HPM1
FPD.
13. Your design should now look like this:
15. Under the Sources tab, right-click on the design_1.bd block design and click Create HDL
Wrapper. Select Let Vivado manage wrapper and auto-update and click OK.
16. Right-click on the design_1_wrapper and click on Set as Top. Now the
design_1_wrapper should be bold and on the top in Design Sources.
6. Right click on xck26_0 and select Program Device. It should automatically navigate to
the .bit file you generated earlier.
7. Your LED should start blinking! (Ask your Tutor for help if it doesn’t)
● Students can show using xmutil loadapp and unloadapp to activate/deactivate the blink3
demo hardware.
● Students can download their own custom hardware to the FPGA using Xilinx Vivado.
And the custom HW has LED blinking at required rate.
● Students explain their design to Tutor (how did you design it, process of writing the code
and how the code works, how the programming of the FPGA works).
● Answer questions from Tutor.