In this post we’re going to setup the Kria KV260 Vision AI Starter Kit for use with PYNQ. For other platforms like the PYNQ-Z1, the PYNQ setup is quite simple: we download a disk image file for the version of PYNQ that we want to use and we just burn that image onto our SD card. For the Kria, it’s a bit different and unfortunately it’s a bit more complicated, at least it is at the moment I write this post.
So to set the playing field, this is the hardware that I’m using. Hopefully you have the same setup for this:
- Kria KV260 Vision AI Starter Kit (PCB Revision B04)
- 12VDC/3A Power supply (center pin positive, not included in the kit)
- SanDisk 32GB microSD card (not included in the kit)
- USB keyboard and mouse connected to the Kria
- DisplayPort cable connecting Kria to a monitor
- Ethernet cable connecting to your network router
Burn the Kria Ubuntu image to an SD card
To start with, follow this link to download Ubuntu for Kria. On the day that I write this post, there are two versions that you can download:
|Ubuntu Desktop 22.04 LTS||This latest version is currently described as a pre-production release. The Xilinx wiki mentions that there are some limitations associated with this version. I tried it anyway and found that it crashes during boot; it turns out that we need the 2022.1 Boot firmware to use this image on the KV260 and my board probably has the older 2021.1 version. So let’s not use this one for now.|
|Ubuntu Desktop 20.04.3 LTS||This is the version that we want to use. Note that it will determine the PYNQ release that we will eventually install.|
Once you’ve downloaded the file (
iot-kria-classic-desktop-2004-x03-20211110-98.img.xz) to your desktop PC , you will have to extract the image file
from it. If you’re using Windows, you would use 7-Zip to extract the image file. If you’re using Ubuntu, you can just right click on
the file and click “Extract Here”.
Now you need to apply that image file to your SD card. In Windows, I use Win32DiskImager. In Ubuntu, you would use Disk Image Writer. Make sure that your SD card is plugged in, and that you have correctly selected it as the target disk.
Boot Ubuntu on the Kria
With the keyboard, mouse and monitor plugged into the Kria, insert the SD card into the slot and power up the Kria.
If you want to monitor the boot sequence, you can plug a USB cable into the USB-UART port of the Kria and open a serial terminal on your desktop PC set to the correct comport and the speed of 115200bps.
After a minute or so you should see the Ubuntu login screen on the Kria’s monitor. Login to Ubuntu using these credentials:
You should then be forced to change the password. The username will be the same.
Now let’s open a command terminal in Ubuntu. The easy way to do that is by pressing
Ctrl-Alt-T. Alternatively you
can click the button in the bottom left corner of the screen (Show Applications) and then typing
terminal in the
With the terminal open, we want to make sure that the Kria has access to the internet. We can do this by running ping:
If you can’t ping successfully with that, then you should try to figure out what is wrong with your network connection and fix it before continuing.
Update the system
Now with a fresh Ubuntu installation, we should always start off with an update of the core
utilities. However, as you’re probably doing this right from the first boot of this Ubuntu installation, you’re probably
going to get blocked by
unattended-upgrades (more about that here).
The automatic updater is likely to have a long queue of updates that it is
currently downloading and preparing in the background, and during that time it wont let you update things manually as we would like
to. So first what we want to do is to temporarily switch off
unattended-upgrades, do our updates, install the rest of our tools
and then turn it back on when we are done.
unattended-upgrades(the automatic updater) by running the following command:
sudo dpkg-reconfigure -plow unattended-upgrades
- You will be asked if you want to automatically download and install stable updates. Select “No” and press Enter (don’t worry we’ll turn it back on later). Then reboot the system (be patient, the reboot takes a few minutes).
- Login to Ubuntu again, open a terminal (
Ctrl-Alt-T) and update the system:
sudo apt update sudo apt -f install sudo apt full-upgrade
- Now we can complete the steps described in the
Kria KV260 Getting Started Guide
by installing the
sudo snap install xlnx-config --classic --channel=1.x
- Finally running the
unattended-upgradesback on. Select “Yes”.
sudo dpkg-reconfigure -plow unattended-upgrades
Now it’s time to setup PYNQ. Open a command line terminal
Ctrl-Alt-T in Ubuntu (on the Kria KV260) and clone the
PYNQ git repository.
- Clone the Kria PYNQ git repository, then
cdinto the directory:
git clone https://github.com/Xilinx/Kria-PYNQ.git cd Kria-PYNQ
- At the time of writing, the latest release in the repo is release v3.0. In the notes for release v3.0, it says that it is intended for Ubuntu 22.04 (if you try to use the install script of release v3.0, like I did, you run into issues with missing dependencies, so don’t bother trying). Since we’re using Ubuntu 20.04.3, we should checkout an older release of the repository, the only one being release v1.0 (why was there no release v2.0?). I’m going to take a risk and checkout a commit that is slightly newer than release v1.0.
git checkout 43e3385
- Now let’s try running the install script:
sudo bash install.sh -b KV260
Be patient because the PYNQ install takes some time (about 20 minutes). I did end up seeing some red errors flash over the screen but it seems like everything worked nonetheless. Had I used release v1.0 I probably wouldn’t have had any errors. You can download my complete log here.
Open Jupyter notebooks in Chrome
Once the PYNQ install script has completed successfully, you should be able to open Jupyter notebooks on your desktop PC.
- Open Chrome on a PC that is on the same network as the Kria and type this in the address bar:
- Use the password
xilinxand click “Log in”.
Jupyter notebooks is now ready for you to use. You can explore through the different folders and try out some of the examples.
Setup the Kria for sharing files with your PC
To work with PYNQ effectively we want to have the ability to easily copy files from our desktop PC to the PYNQ platform. This is useful when we want to transfer new overlays to the board. If you’re using Windows, the easiest way to set this up (in my opinion) is with Samba, so here’s how to do it.
- In a terminal window on the Kria, install
sudo apt install samba
- Edit the Samba configuration file and create a file share:
sudo nano /etc/samba/smb.conf
While in the nano text editor, you will need to scroll down to the bottom of the file and paste this in there:
[share] comment = PYNQ Share path = /home/root/jupyter_notebooks browsable = yes guest ok = yes read only = no create mask = 0755
Then save the file by pressing
Ctrl-O and pressing enter to confirm the filename. Then exit nano
- Restart the samba services:
sudo systemctl restart smbd sudo systemctl restart nmbd
Get the IP address of our Kria board:
hostname -I(note that your board will probably have a different IP address, it depends on your network setup)
Now from a Windows PC on the same network as the Kria, we should be able to open up an explorer window and type the IP address of the Kria (like this
\\192.168.2.54) to see the Jupyter notebook files.
So now we’re ready to make custom overlays and copy them over to our Kria.
I have a few interesting things that I need to get done with this Kria board in the next few days so you should see a few more posts to come. Specifically I want to get the AR1335 image sensor working on J8 which is the connector with a direct path to the FPGA (ie. bypassing the ISP). PYNQ makes this kind of job really easy to do because I can configure the image sensor on-the-fly and then immediately pull images out of it and see the results. Trying to accomplish the same thing with a bare metal application is insanely more time consuming.
In the short term, the next thing that I want to do is to update my Kria’s boot firmware so that we can then use the latest Ubuntu and PYNQ releases. That should be the next post.