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:
Win32DiskImager (https://win32diskimager.org/)
PuTTY (https://www.putty.org/)
How to write the image to a microSD card:
Download the image file Pynq-Redpitaya-125-14-3.0.1.img from the repository.
Write the image file to the microSD card with the Win32DiskImager program.
How to boot the board:
Insert the microSD card into the board, connect the micro USB cable to the PC, and connect the power supply.
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
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

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:
FileZilla (https://filezilla-project.org/)
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
Red Pitaya STEMlab 125-14, https://redpitaya.com/stemlab-125-14/
PYNQ for Redpitaya-125-14, https://github.com/dspsandbox/Pynq-Redpitaya-125
Connect to your WiFi using Linux command line, https://www.youtube.com/watch?v=c-9kRhvs3Mw
How to Set Permanent resolv.conf on Ubuntu, https://musaamin.web.id/set-permanent-resolv-conf-ubuntu/
Tutorial: PYNQ DMA (Part 1: Hardware design), https://discuss.pynq.io/t/tutorial-pynq-dma-part-1-hardware-design/3133
Tutorial: PYNQ DMA (Part 2: Using the DMA from PYNQ), https://discuss.pynq.io/t/tutorial-pynq-dma-part-2-using-the-dma-from-pynq/3134
Last updated