Pluto SDR PYNQ Image

Hi all! I recently presented the PYNQ image that I created for the Analog Devices Pluto SDR / AntSDR E200 at the 2024 GNU Radio Conference, and @jgoldsmith suggested that I post the project on this forum as well.

I started my project by creating a PYNQ image for the Pluto SDR, with the hope of creating a low-cost alternative to the RFSoC 4x2 kit for learning FPGA acceleration in software defined radio. The Pluto SDR has a few constraints that make porting PYNQ somewhat difficult. For starters, the ADI firmware for the Pluto SDR is created using Buildroot, not PetaLinux. My first task was converting the Linux system configuration into a PetaLinux BSP for compatibility with the PYNQ sdbuild flow.

The PYNQ root filesystem was much too large to fit into the 32 MB of flash memory onboard the Pluto. I solved this issue by hosting the root filesystem and boot files on an external USB storage drive, and then booted the system manually from the U-Boot console by loading the kernel into RAM and pointing to an external rootfs.

The Linux drivers for the AD936x RFIC family are not in mainline Linux, so the Analog Devices fork of the Linux kernel had to be integrated into the PYNQ build flow as well. I solved this problem by integrating the meta-adi Yocto layer into my PetaLinux BSP.

These steps all worked, and I was able to boot into PYNQ running on my Pluto. Hereā€™s an image of what the hardware setup looks like:

I ran into some issues when actually loading overlays, which I believe are related to some missing device tree nodes. Iā€™m still working on solving that issue.

I also created a fork of the MicroPhase PYNQ image for their AntSDR E200 with some significant improvements. I added a PYNQ userspace package for the Analog Devices IIO software, which allows PYNQ systems to interface with IIO devices both locally and from remote IIO contexts. I used the AntSDR E200 to create a demonstration FM radio hardware accelerator using PYNQ and GNU Radio. You can see a video demo of this in the recording of my GNU Radio Conference presentation that Iā€™ve linked below.

I think that combining PYNQ with low-cost SDRs has a lot of potential for enabling simple integration of hardware acceleration into RF signal processing. By using PYNQ and the Jupyter notebook interface, DSP functions can be easily loaded into the datapath to offload high-rate computations before the samples are streamed to a host computer.

Here are a few links to check out if youā€™re interested in this project:

My GNU Radio Conference presentation goes into more detail, and I have a longer slide deck that I can share upon request (the file size is too large to upload to this post).

Thanks for reading!

5 Likes

Thanks for putting this project together and documenting it. I tried to recursively clone both repos, but it seems that they reference a repo of yours that needs a credential:

fatal: clone of ā€˜git@github.com:zehicks/hdl.gitā€™ into submodule path xxxxxxx/PYNQ-SDR/antsdr-pynq/hdlā€™ failed
Failed to clone ā€˜hdlā€™. Retry scheduled
Cloning into ā€˜xxxxxxx//PYNQ-SDR/antsdr-pynq/PYNQā€™ā€¦
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

All of the submodule repositories should be public, so it sounds like it might be an SSH issue. The submodules are set up to clone via SSH, not HTTPS. Does your GitHub account have an SSH key associated with your machine?

1 Like

Thanks Zach, I had surmised as much. Iā€™ll regenerate my key to be sure, but I just wanted to give a heads up on this, if it wasnā€™t working as you intended.

1 Like

Hi zach,
thanks for the project, well I have a board antsdre200,

Well I clone the repository, then
run the command make, create vivado project and library from adi is ok,

but then I have the error

Makefile:396: *** REBUILD_PYNQ_SDIST not set and PYNQ_SDIST file /home/jdsl/Documentos/antsdr-pynq/PYNQ/sdbuild/prebuilt/pynq_sdist.tar.gz does not exist

I have seen the antsdr-pynq/PYNQ/sdbuild/prebuildt/ directory and the files (pynq_sdist.tar.gz) in that folder are not found

Do I have to create them? and how is it done?
or should I download them and place them in that folder?

thanks

1 Like

Hey, thanks for taking a look at my project. The PYNQ source distribution can be downloaded here. Follow the instructions linked under the ā€œBuild a PYNQ imageā€ section by downloading the PYNQ sdist tarball and also the rootfs tarball.

1 Like

Thanks zach to answer quickly,

I have followed the recommendations from (PYNQ SD Card image ā€” Python productivity for Zynq (Pynq)),

cp pynq_rootfs.<arm|aarch64>.tar.gz /sdbuild/prebuilt/pynq_rootfs.<arm|aarch64>.tar.gz
cp pynq-.tar.gz /sdbuild/prebuilt/pynq_sdist.tar.gz

I have been able to reconstruct the image to:
Pynq-z1
Pynq-z2
everything is ok,

then, for board e200 I have the error in this task, when build device tree for e200

ERROR: linux-xlnx-5.15.19+gitAUTOINC+b0c1be301e-r0 do_patch: Could not apply patches for zynq-generic.

well, Iā€™ll continue trying to build the image for the board e200, if you have any advice itā€™ll be very helpful, thanks zach.

attach the file build.log
build.log (98.2 KB)

1 Like

Can you share the contents of /home/jdsl/Documentos/antsdr-pynq/PYNQ/sdbuild/build/e200/petalinux_project/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/linux-xlnx/5.15.19+gitAUTOINC+b0c1be301e-r0/temp/log.do_patch.457078 ?

1 Like

hi,
attach again the file build.log, because I make a clean the last build and generate again, also the same error.

well, attach the files

build.log
build.log (98.2 KB)

Files:
log.do_patch.25803
run.do_patch.25803
linux-xlnx_2022.1.bb

inside the zip log.25803.zip
log.25803.zip (4.6 KB)

thanks zach

Hmm I donā€™t see anything obvious that could be going wrong. You are using PetaLinux 2022.1, correct? What command are you using to run the build? Just ā€œmakeā€?

yes, I use Petalinux 2022.1.

I have managed to get for antsdre200 to do everything with the following command sequence

Make base ok
Make pynq/kernel ok

Summarizing

1
clone the repository
git clone --recursive git@github.com:zehicks/antsdr-pynq.git

2

PYNQ repository/sdbuild/scripts/setup_host.sh (It took only once at the beginning to install the tools)

3
download

cp pynq_rootfs.<arm|aarch64>.tar.gz /sdbuild/prebuilt/pynq_rootfs.<arm|aarch64>.tar.gz

cp pynq-.tar.gz /sdbuild/prebuilt/pynq_sdist.tar.gz

4
source /Vitis/2022.1/settings64.sh
source /petalinux-2022.1-final/settings.sh

5
from PYNQ repository/

make base
make pynq/kernel

everithing is ok. :smiley:

the outputs in the
PYNQ repository/PYNQ/sdbuild/output/boot/e200 folder.

When the error happened

The only difference Iā€™ve seen is that when you pass the argument

make all, error building device tree(dbt)
or
make pynq, error building device tree

I still donā€™t understand the difference make pynq(that commad give error dbt) versus make pynq/kernel(that command work),

many thanks zach

Hello, Zach

Well, the solution for command, make pynq or make all

Iā€™ve checked the Makefile inside the /PYNQ/sdbuild folder
on line 16 and 17

16 #LINUX_VERSION := 5.15.19-xilinx-v2022.1
17 LINUX_VERSION := 5.15.36-xilinx-v2022.1
which is incorrect for version 2022.1

The right thing to do in PYNQ repository/PYNQ/sdbuild/Makefile

16 LINUX_VERSION := 5.15.19-xilinx-v2022.1
17 #LINUX_VERSION := 5.15.36-xilinx-v2022.2

also the version 5.15.36 is for 2022.2

Thanks zach.

The Linux kernel actually gets replaced with version 5.15.36 within the meta-adi Yocto layer, thatā€™s why I modified the PYNQ sdbuild makefile.

Hi. What a great job.

I was thinking of the same path and so found yours. I have tried to do this and am now at the point of device mounting problems, it seems.
Have you been able to solve the device problems? Does your git library now run the iiod server smoothly?

1 Like

Thanks for checking out my project!

What do you mean by ā€œdevice mountingā€? Were you able to build the PetaLinux project, and are not able to copy the files to the USB drive? Or another step in the process?

I have been able to compile Analog Device kernel and meta-adi layers (with petalinux, not exactly pynq). Then I tried to make iiod server run successfully like a pluto does with its buildroot-built rootfs. But that system based on busybox and buildroot runs some scripts and mounts some devices (for example iio_ffs) which I could not run and mount successfully in my project.

If on your project I would be able to run python and, install and use pyadi-iio, that would be great!

My project includes support for both iiod remote servers and pyadi-iio running on-target. I only verified functionality on the AntSDR E200 however, so there are still some lingering bugs in the Pluto SDR image.

Zach, thank you for your effort! Iā€™ve managed to build the base project and prepare the SD card for AntSDR. I can connect to the petalinux console via USB and to the jupyter server via Ethernet. However, Iā€™ve encountered some problems while trying to generate the Vivado project for the ā€˜templateā€™ overlay.

Iā€™ve conducted a following procedure:

  1. Copy the template directory as template_cpy
    cp -r boards/e200/template boards/e200/template_cpy
  2. Enter the antesdre200 directory in template_cpy
    cd boards/e200/template_cpy/antsdre200
  3. Source the Vivado/Vitis executables
    source /tools/Xilinx/Vitis/2022.1/settings64.sh
    source /tools/Xilinx/Vivado/2022.1/settings64.sh
  4. Run make with a flag that skips verification of Vivado version (without it Vivado 2021.1 is required to proceed)
    make ADI_IGNORE_VERSION_CHECK=1

And the step 4 fails with a bunch of synthesis errors. Here is the vivado log file:
antsdre200_vivado.log (96.8 KB)

Do you know what may be the cause of these errors?
I am using a Virtualbox VM with Ubuntu 18.04, Vivado 2022.1. The same procedure applied to the ā€˜baseā€™ overlay passes without errors, so this issue has to be specific to the ā€˜templateā€™ overlay.
Thanks

One more thingā€¦
When trying to run the base/pynq_iio notebook it seems that FPGA is not detected, and the overlay cannot be programmed. The following error occurs:
[XRT] ERROR: boost::filesystem::directory_iterator::construct: No such file or directory: ā€œ/dev/dri/by-path/ā€
Moreover, the xbutil examine command (run with sudo) shows no devices found. Could you please provide some hint how to solve this? I also checked the original MicroPhase pynq image and it detects the device.
Best regards