PYNQ port

In case this is of any use to anyone, I ported PYNQ to the Snickerdoodle over the last few days:

https://github.com/peabody124/snickerdoodle-pynq

If you don’t know, PYNQ is a distribution (using the term loosely) based on Petalinux that aims to provide a Python interface to using PL (termed Overlays). In short it is extremely cool to use a Jupyter notebook running on the embedded system and call functions on an object to make the PL do something.

The base overlay they provide for a few other boards have quite a bit of functionality (e.g. ADC/DAC/HDMI/GPIO). As stands the base overlay here has absolutely nothing, as I am using this for a pretty specific / unique application that wouldn’t generalize. If anyone wants to point me to a TCL file for a “full featured” PL layer for the Snickerdoodle I could take a crack at expanding this.

peabody, this is awesome.

I’ve seriously had the “old” PYNQ-on-snickerdoodle topic open in a browser tab for at least two months…

Someone at Xilinx did recently provide the following resrouces – which I’m guessing you’ve already seen (although the last one might be helpful):

Updated docs here: https://pynq.readthedocs.io

SD card build instructions here:
https://pynq.readthedocs.io/en/v2.3/pynq_sd_card.html

Updated workshop material here:
https://github.com/Xilinx/PYNQ_Workshop/

How to connect and interact with your own bitstream from PYNQ:
https://github.com/Xilinx/PYNQ_Workshop/tree/master/Session_4
(GPIO, AXI Slave (MMIO), AXI Master (Memory allocation), AXI stream (DMA)).

Glad to hear it has some interest! Yeah I looked through the workshops and found them quite happy.

I’m interacting with some custom IP that is moving a decent chunk of data around via DMA (AXI Stream -> DMA Peripheral). I’ve demonstrated getting that working through PYNQ, including running an asynchronous loop using asyncio triggered by the DMA IRQ. That isn’t demonstrated anywhere and I might try and decouple my code from my IP so I can release a few examples in the repository, too. I want to switch to Scatter Gather control soon to get the CPU entirely out to the loop, but that will require some bit-banging the controller since it isn’t implemented yet in PYNQ.

I’ve also added an Microblaze IOP for processing the stream which has an interrupt coming in, and got that responding to interrupts from DMA (again there were no examples there, so it took a bit of time). The magic cells work and it is super cool to just push the code onto it like that.

peabody, any chance you have a compiled PYNQ image for snickerdoodle (prime or otherwise) posted somewhere? I was just talking with the folks at Xilinx and they’d be willing to add it to their list of downloadable images on pynq.io, which would be kind of cool…

Watch out for a burst of interest in this post.

Adam Taylor has been talking about installing Pynq on Snickerdoodle on HacksterIO

I am still having problems getting PentaLinux installed!

(Not enough time, even less concentration! Not old enough, or rich enough to retire, plenty old enough to forget what I read 20 mins ago!) :slight_smile:

So has anyone been able to install PYNQ per the instructions on HacksterIO ? I am very much interested in using this since there is no DMA support through the krtkl linux distro.

FYI, using the instructions on HacksterIO along with many hours of searching online I have successfully created a sd-2.3.img file and it boots PYNQ on my snickerdoodle black. The WIFI works and I am able to connect to the Jupiter Notebook. Currently I am using the https://github.com/krtkl/snickerdoodle-base.git as the overlay and have been able to use the “Show All Clocks” example to show all the current clock rates on the board. Next I plan to create an AXI_DMA overlay and test the Asyncio DMA functionality.

Wow! Well done sir! Any chance you are able to release the image file for the rest of with less time and in my case almost certainly fewer brain-cells!

I don’t mind releasing it, I’m still trying to test all the functionality, which is taking a long time. Today I tested loading bit files, changing fabric clocks, and read/write to the GPIO. Do you know how I could release it, I have nowhere to place the image ?

@bfrantz

If it’s “general purpose” enough (which it seems to be), you can email it to me and I can stick it right on our Downloads page! Also, if you want to post a follow up to Adam’s post on Hackster, we can link to that right on the main snickerdoodle page as well.

-RC

Its probably not as general as it could be since I left out the USB connection in the ZYNQ processor MIO Configuration. I was only planning on using it with my Snickerdoodle Black as I don’t have a piSmasher. I could try and add that in but I have no way of testing it. As noted in the Hackster post everything is based on the 2018.2 builds. I’ll try and e-mail you my current image. Note you will have to follow the instruction on Hackster.io to get the wireless up and running. I also found out in order to access the J3 pins via GPIO I had to do the following:

from pynq import GPIO

from enum import IntEnum

class J3(IntEnum):
P2 = 958
P4 = 959
P5 = 922
P6 = 925
P7 = 923
P8 = 924
P11 = 926
P12 = 929
P13 = 927
P14 = 928
P17 = 930
P18 = 933
P19 = 931
P20 = 932
P23 = 934
P24 = 937
P25 = 935
P26 = 936
P29 = 938
P30 = 941
P31 = 939
P32 = 940
P35 = 942
P36 = 945
P37 = 943
P38 = 944

j3_pin2 = GPIO(J3.P2, ‘out’)

j3_pin2.write(1)

 

The PS GPIO(63:0) can be accessed as normal:

from pynq import GPIO

gpio0 = GPIO(GPIO.get_gpio_pin(0), ‘out’)

gpio0.write(1)

@bfrantz, what would you say to us sending you a free piSmasher to thank you for your efforts on this? That way you’ll have all the hardware you need to test out the new image…

In case it is useful, I updated my original repository to now support the SnickerdoodleBlack and PiSmasher (and to use the latest PYNQ 2.4) so it is using ubuntu 18.04 and the 4.14 kernel. Took quite a while to get Ethernet and WiFi going, but thankfully it is finally. Here is the link:

https://github.com/peabody124/snickerdoodle-pynq

Next up is adding some of the more interesting functionality but I think I finally understand the petalinux-build process that should be facilitated. It is so nice programming and talking to the PL through python.

Does anyone know the magnitude of performance benefit of having the proper wl18xx drivers and configuration loaded? It seems like my WiFi bandwidth is better using the official krtkl images.

Sorry I missed this. If there is still interest please let me know and I can provide an image. You can always email me too (same username at gmail)

That’s awesome, @peabody124! @bfrantz has also been working on this. Per your other reply, I’ll email you to see if we can get the other peripherals supported and the image posted.

As far as the wireless drivers go, I can’t speak to the performance when using anything other than our default configuration. There is still some performance to be squeezed out there for sure…

I getting this error while building image.

 

 

source SnickerdoodleBlack.tcl -notrace
WARNING: [Device 21-436] No parts matched ‘xc7z020clg400-3’
ERROR: [Coretcl 2-106] Specified part could not be found.
INFO: [Common 17-206] Exiting Vivado at Thu Aug 22 14:49:32 2019…
makefile:10: recipe for target ‘bit’ failed
make[1]: *** [bit] Error 1
make[1]: Leaving directory ‘/home/hiren/snickerdoodle/PYNQ/sdbuild/build/SnickerdoodleBlack/petalinux_bsp/hardware_project’
Makefile:298: recipe for target ‘/home/hiren/snickerdoodle/PYNQ/sdbuild/build/SnickerdoodleBlack/petalinux_bsp/xilinx-snickerdoodleblack-2018.3.bsp’ failed
make: *** [/home/hiren/snickerdoodle/PYNQ/sdbuild/build/SnickerdoodleBlack/petalinux_bsp/xilinx-snickerdoodleblack-2018.3.bsp] Error 2

The “no parts matched” error might be a tool configuration/version problem. Looks like the WebPACK version of Vivado requires a slightly different part name syntax:

http://ettus.80997.x6.nabble.com/USRP-users-problem-compiling-example-rfnoc-testbench-td13211.html

You’ll also want to make sure you selected the correct Zynq devices to support during install.

My PYNQ image was successfully built. Thank you Ryan Cousins and peabody124 for your help.

Now I am working on how I can utilize the piSmasher with built PYNQ image.

 

But I am facing some issues with HDMI utilization, can you help me with it.

 

Thanks

Hiren

Thanks great to hear, Hiren! Can you elaborate on the issues you’re having with the HDMI? And were you able to get all the other interfaces (Ethernet, USB, audio) working properly?

Hello,

The Ethernet ports are working and I am able to make remote connections. About the HDMI and USB that part is still in dark for me.

As far as I studied input-output functionality will require “base.bit” file which is then loaded by the ‘overlay’ in the python code. The “base.bit” file currently does not have the functionality of HDMI and USB. I assume I will have to synthesize and make a bit file for the external connection of peripherals on PiSmasher. The synthesis will require IP core of HDMI, USB is the source for the available?

This is my understanding until now, please correct me if I am wrong.

 

Thanks,

Hiren