Setting up the PYNQ board

Obtaining the PYNQ Board

The lab contains PYNQ-Z2 boards at each workstation. You do not need to buy your own board.

If you want to purchase your own Pynq-Z2 board, you can do so online at several distributors:

Imaging the SD card

The PYNQ runs Linux off of an external micro SD card that you must provide. The SD card must have a valid system image in order for Linux to run. We have provided a working system image here (unzip it after you download it), but you must image this to your own SD card. The micro SD card must be at least 16GB and class 10 or better. The official PYNQ documentation has a guide to writing the SD card image that you should follow. Some notes:

  • In the lab you do not need to use sudo to run the dd command, so remove this from the command when you image the SD card.
  • You probably won’t have space to unzip the .img file onto your home directory, so instead extract it to the /tmp folder on the computers. This is a local folder that is cleared when you log out, so you don’t have to worry about filling up the hard drive.
  • If you are using your own Windows computer and run into issues using Win32DiskImager, another alternative is to use http://etcher.io.

Powering Up the PYNQ Board

To power the PYNQ board, you will need to connect the micro USB cable, insert the micro USB cable, and turn on the power switch.

Powering Down the PYNQ Board

Important: Once you have powered up your board, it should begin to boot Linux. Keep in mind that once you have it powered, treat it like a regular computer running Linux, and don’t unplug it or turn off the power switch until you have shut it down properly. If you unplug it or turn off the power switch while it is running, you risk corrupting the SD card and you may have to re-image it.

Once you have connected to the board using the methods described below, you can shut down the board by typing

sudo poweroff

in the terminal. Wait 10 seconds before shutting of the power switch.

Verifying BOOT using HDMI

The PYNQ video signal comes from the HDMI port labeled HDMI Out located on the topside of the board. This should already be connected to a dedicated monitor in the lab. If you work remotely, you will need to find an HDMI-compatible display to use.

You can verify that your PYNQ board is imaged correctly, and connected to the display correctly by powering it on, and after it has booted (about 1 min), you should see something like this on your display:

Connect the PYNQ to Your Network

You can skip the rest of this page if only plan to work in the lab and not work remotely.

You will need to connect your PYNQ to a network with internet access. The PYNQ board does not have WiFi, so you will need a physical Ethernet connection. This can be done three ways:

  • Connect the PYNQ directly to your home router or switch (this is how it is setup in the lab).
  • Connect the PYNQ directly to the Ethernet port on your computer. This can be done if you aren’t using the Ethernet port for your computer’s internet connection, ie. you are using WiFi or have an extra ethernet port.
  • If you don’t have an extra Ethernet port on your computer, you can buy a USB-to-Ethernet adapter such as the one here. Make sure to buy one that is compatible with your computer.

Internet Sharing

If you used Option #1 above and connected the PYNQ directly to your home network, you can skip this section. Otherwise, if you connected the PYNQ to your computer, follow the steps in this section to share your internet connection with the PYNQ board.

Windows

  • Open Windows Settings (Windows Key + I) and go to Network & Internet.
  • Expand the connection you want to share (Ethernet or WiFi), locate the More adapter options item and click Edit.
  • In the adapter pop-up window, click the Sharing tab. Check the box for Allow other network users to connect through this computer’s Internet connection.

Mac

https://support.apple.com/en-ca/guide/mac-help/mchlp1540/mac

Ubuntu Linux

Find the PYNQ IP Address

Next you will need to determine what IP address your PYNQ board was given. Make sure you insert the imaged SD card into your PYNQ board and power it on before proceeding.

If you use option 1 or 2 below, keep in mind that as you look for the PYNQ IP address, the PYNQ boards tend to have MAC addresses that start with 00:05:6b:.

Option 1: Retrieve from router. You can only use this technique if you used option #1 above, and your PYNQ is connected directly to your home router or switch

Your PYNQ should be given an IP address on your home network. This is likely something like 192.168.x.x and you may be able to find it using the DHCP list on your router’s configuration webpage or app.

Option 2: Use ARP.

ARP (Address Resolution Protocol) allows you to view IP addresses and MAC addresses of computers on your network.

In Windows, Linux, or Mac, you should be able to run arp -a in the terminal to view a list of IP/MAC pairs. They are usually grouped by network device, so if you have the PYNQ connected to your computer via USB-to-Ethernet adapter, the PYNQ should be in it’s own category.

Option 3: Connect to the PYNQ board using UART

The PYNQ Serial page describes how to get a command prompt on the PYNQ board using the USB connection. From there you can run ip a to view the network adapters on the PYNQ board and their IP addresses. The Ethernet adapter on the PYNQ is named eth0.

SSH Communication

Once you have the PYNQ set up you can connect to it using SSH.

If you are working in the lab, you can access the PYNQ board in the lab using:

ssh byu@pynq03.ee.byu.edu

where the “03” is replaced with the number of the PYNQ board you are using. The default password is byu.

If working remotely, you will need to replace pynq03.ee.byu.edu with your PYNQ’s IP address.

SSH Keys

📝 Run this on your computer. If you are still SSh’d into the PYNQ board, type exit to get back to your computer.

Instead of having to authenticate with a password each time connecting to the PYNQ, you can set up an SSH key to do automatic authentication. This tutorial explains how to set this up in a variety of ways.

A few of notes before following the tutorial:

  • If your computer doesn’t have ssh-copy-id installed, you will need to follow the instructions below that (the lab computers have it installed).
  • Although it is less secure, it is nicer if you do not specify a passphrase for the key; this will give you secure, passwordless access to the PYNQ. Presumably the host computer is protected by password, which makes not having a passphrase less of an issue
  • You probably don’t want to follow Step 4 of the tutorial

Before proceeding, make sure you can ssh into your PYNQ board without being prompted for a password.

Change Passwords

📝 Run this on the PYNQ board

You should change the password for the byu account in your PYNQ Linux system. This is not just to prevent people from looking at your work, it also prevents another student from accidentally SSH’ing in your PYNQ board and modifying your files.

To change the byu user password, SSH into your PYNQ board and run the passwd command.