Getting Started with PYNQ on Red Pitaya STEMlab 125-14

Red Pitaya STEMlab 125-14

Red Pitaya is a project that aims to provide an alternative to numerous expensive laboratory measuring and control instruments. It is classified as open-source, but the hardware design is proprietary. This board uses the Xilinx Zynq 7000 (XC7Z010-1CLG400C).

This board has its own Linux image that comes with web-based measurement applications, but in this case I don't do measurement, so I want to try to use the PYNQ image.

MicroSD Setup

Red Pitaya STEMlab 125-14 is not officially supported by PYNQ. Thankfully, someone has already built the PYNQ image for this board. So, I just use the PYNQ image from this repository.

Required programs:

How to write the image to a microSD card:

  1. Download the image file Pynq-Redpitaya-125-14-3.0.1.img from the repository.

  2. Write the image file to the microSD card with the Win32DiskImager program.

How to boot the board:

  1. Insert the microSD card into the board, connect the micro USB cable to the PC, and connect the power supply.

  2. Open the PuTTY program and set up a serial connection. Select the appropriate COM port by looking at Device Manager (Windows).

    • Baud rate = 115200

    • Data bits = 8

    • Stop bits = 1

    • Flow control = None

    • Parity = None

  3. The system is automatically logged in, but if you want to connect to the board from an SSH terminal, then we have to enter the username and password.

    • Username: xilinx

    • Password: xilinx

Important

If you want to turn off the board, you should shutdown it; don't immediately remove the power supply. This is done to avoid corrupted microSD, which can cause boot failure.

How to turn off the board:

Run this command.

sudo shutdown -h now

USB Wi-Fi Dongle Setup

I use an Edimax EW-7811Un USB Wi-Fi dongle that uses the Realtek RTL8188CUS chipset. The driver for this Wi-Fi dongle is already installed.

We can use this command to display information about USB buses and the devices connected to them. We will see the USB Wi-Fi dongle detected.

lsusb

Next, we can use this command to connect to a Wi-Fi access point.

sudo wpa_passphrase "YourSSID" "YourPassword" > wpa_supplicant.conf
sudo wpa_supplicant -c wpa_supplicant.conf -i wlan0 -B -Dnl80211

Then, use this command to configure a static IP address.

sudo nano /etc/network/interfaces.d/wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.99
netmask 255.255.255.0
gateway 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Finally, we can reboot the board to see the changes.

sudo reboot

Now, we can login to the Jupyter Notebook via web browser by entering the IP address of the board:

  • URL: 192.168.1.99:9090

  • Password: xilinx

Wi-Fi Connection with PEAP

We can also connect to a Wi-Fi access point that uses PEAP, which is commonly used in enterprise wireless and wired networks. This is the configuration for the wpa_supplicant.conf.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
        ssid="YourSSID"
        scan_ssid=1
        key_mgmt=WPA-EAP
        identity="YourUsername"
        password="YourPassword"
        eap=PEAP
        phase1="peaplabel=0"
        phase2="auth=MSCHAPV2"
}

This configuration is used to configure the board with a dynamic IP address.

sudo nano /etc/network/interfaces.d/wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

DNS Configuration

For some reason, when I try to install a Python package using pip, an error occurs, and I find that the error is related to the DNS configuration. So, I set the DNS permanently in the resolv.conf file.

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb5004190>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/yfinance/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb5004298>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/yfinance/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb50043a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/yfinance/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb50044f0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/yfinance/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb50045c8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/yfinance/
ERROR: Could not find a version that satisfies the requirement yfinance (from versions: none)
ERROR: No matching distribution found for yfinance

First, we install the resolvconf package.

sudo apt install resolvconf

Then, we activate and run the resolvconf service.

sudo systemctl enable resolvconf
sudo systemctl start resolvconf
sudo systemctl status resolvconf 

Next, we enter the nameserver IP address in the head resolvconf configuration file.

sudo nano /etc/resolvconf/resolv.conf.d/head 
nameserver 8.8.8.8
nameserver 8.8.4.4

After that, we run the resolv.conf update.

sudo resolvconf --enable-updates
sudo resolvconf -u

If an error like this occurs, then run the following command.

/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
sudo dpkg-reconfigure resolvconf

Finally, we can verify by displaying the contents of the resolv.conf file.

cat /etc/resolv.conf

Hardware Design

Now that we have configured the board, the next step is to try to create a basic hardware design. My hardware design consists of an AXI GPIO and an AXI DMA. The AXI GPIO is connected to 8 LEDs. The AXI DMA is connected to a looped-back AXIS FIFO.

The following figure shows the Zynq IP high-performance port configuration. The S AXI HP0 and S AXI HP2 interfaces are enabled.

The following figure shows the AXI DMA IP configuration.

The following figure shows the AXI GPIO IP configuration.

Upload Design Files

To upload files, such as bitstreams, from the laptop to the board, you can use FileZilla via the Ethernet connection.

Required programs:

The connections required are:

  • Host: 192.168.1.99

  • Username: xilinx

  • Password: xilinx

  • Port: 22

To upload the hardware design to PYNQ, you need to upload three files: .bit, .tcl, and .hwh.

Python Program

The following notebook is used to test the hardware design. It consists of a Python program to test the AXI GPIO and the AXI DMA.

The results show that the AXI GPIO and AXI DMA can be accessed successfully.

References

Last updated