I don't know about you, but I've always meant to delve properly into Pynq and I'm looking forward to the three workshops, starting with this one on 5th May. PYNQ-Z2 Workshop: Getting Started with PYNQ (Win a $500 Gift Card for Your Embedded Vision Project!)


I bought a PYNZ-Z2 and thought it would be wise just to get to a point where I could hit the ground running with the workshop. I know it starts from zero, but you don't want to find you miss the first half an hour because you weren't organized enough. I'm going to jot down just a few things I found useful. It's not going to be a Pynq lessons, more of a checklist. If you can already fire up a browser, go to http://pynq:9090 and you see a Jupyter notebook, then you don't need this guide. That's where I'll stop.


Buy the bits you need

PYNQ and accessories

Obviously as mention on the event listing there's a PYNQ-Z2PYNQ-Z2 and (if you don't have any lying around) some male-to-male jumper cables. There are some starter kits - a BasicBasic and AdvancedAdvanced - and if you don't got for these, make sure you have and suitable micro USB cable, network cable and micro SD card of at least 8GB. Once again most E14 members will have this lying around, but if you don't then either get them or go for a starter kit. In case you were wondering what the difference is, the Advanced includes a case and bag to zip it all up into. I don't think we'll need the power supply.



I wasn't going to bother getting a camera with a HDMI output. I was going to use a Raspberry Pi with a Pi camera and use the HDMI output from the Pi. The ApeMan camera mentioned isn't expensive, but I didn't want yet more stuff that I use once cluttering up the place. As my boys have started making their own YouTube videos I relented and got one on eBay. I suspect the really cheap A70 version (with HD output) would do, but decided to go for the A77 (4K version). There's a newer A80 too, but it didn't seem significantly different. You should be able to get one for £25-30 on eBay. Amazon have them but in the UK at least shipping on non-essential items is about a month. Fair enough at the moment, but it means it wouldn't arrive in time for the workshop. I suspect anything with a HDMI output would do for the workshop at a push - TV, PC, whatever. I don't know this, but I would guess we'll do something like edge detection for a demo.


My ApeMan A77 camera arrived. It's well worth the money - even if it's just for all the GoPro compatible accessories it comes with. One thing it doesn't come with though is a micro HDMI cable. If you already have a Pi 4 then you're probably all set, because the Pi 4 also uses micro HDMI. Otherwise, make sure you order a micro HDMI to standard HDMI cable or the appropriate adapters. The camera also expects micro SD card to store images / video. You won't need a card for live throughput, but if you don't have one there's an annoying warning triangle superimposed on the middle of the display!


It seems the workshop article has been updated to a Crosstour brand camera. From the photos it looks to be identical hardware under a different brand.


Hold off on getting this exact camera. I can't get it to work with the PYNQ-Z2 even though another HDMI source (Pi 4) works fine.

Problem with PYNZ-Z2 and HDMI output from camera


Using a Raspberry Pi as a camera

So, I think my Apeman A77 just isn't going to work. I'm going back to "Plan A" of using a Raspberry Pi and a Pi camera V2 as my video source. This is pretty easy. I decided on a Pi 3 over a Pi 4 just because it had full-size HDMI. Both worked when I tried them.


Change your settings

Use Raspberry Pi Configuration to enable the camera. You can also enable SSH if you want an easy way to control it remotely. Change your resulotion to what you need. 1920 x 1080 seems to work fine with the PYNQ-Z2 but apparently we'll be using lower (640 x 480?) in the workshops.

Enable camera and SSHPI display settings


Start your video feed

All you need is a terminal. Type raspivid -t 0 to preview the camera output fullscreen. You need Ctrl-C to stop if required. That's it. You Pi and Pi camera are now working as a HDMI camera and can be used as the input to your PYNQ-Z2.


Get to "zero"

If you're trying to get from zero to hero, we might as well get to zero. The official setup guide is here but I want to add a little bit to it.


Vivado / Vitis

Whenever I've done anything with Zynq, I've found that installing the dev tools takes quite a while and if you're following any sort of guide then the version is extremely important. There is no mention of needing Vivado or Vitis for this course. I guess that's sort of the point of PYNQ and if so it's a good thing. However, I thought I'd mention it. If you're interested in the whole Zynq ecosystem you might want to take a look. Expect a 30GB download and to need lots of memory and disk space. PYNQ's sounding pretty good right now, isn't it?

Vitis 2019.1 is now listed for the Workshop, so get installing! Don't be tempted by 2019.2. It's very different when it comes to the PS side of things - the IDE for coding against the processor defined in the Pynq. If we go anywhere near that part you will really struggle if you're on the wrong version.


PYNQ image

That micro SD card will need a PYNQ image.  The Z2 one is available from here but you will need a Xilinx account to download it. Or you can get it from TUL here without having to register with Xilinx. (Thanks to beacon_dave for pointing this out in the comments.)


All these little things take time and you don't want to be doing it whilst trying to listen to the workshop! Another bit of the guide recommends using Win32DiskImager to copy the img file to the SD card for Windows, ImageWriter for Mac or dd for Linux. I happen to have the latest Raspberry Pi Imager installed as I'd recently done the same for a Pi4. I can confirm that this also works. I'm sure plenty of other image to SD card software like Etcher does too.


Setting a useful IP address

Strangely, the PYNQ-Z2 is set up to use a static IP of I don't think anyone uses 192.168.2.x at home. I've usually seem 192.168.0.x or 192.168.1.x. Once the board boots up this makes it unreachable without lots of messing around with IP addresses. I initially changes my router to use a subnet mask, but then found an easier way!


If you fire up the PYNQ-Z2 board with a USB cable and ethernet cable attached, a serial port will appear. Connect to this using your preferred serial terminal (115200 8-N-1) and you get a bash console. This should let us reconfigure the network. The official FAQ says you need to change /etc/dhcp/dhclient.conf but unfortunately this is incorrect. The file you actually need to modify (in Pynq 2.5 at least) is /etc/network/interfaces.d/eth0. In my case, all I wanted was for the PYNQ board to grab an appropriate IP address via DHCP. This is the original contents of /etc/network/interfaces.d/eth0:

auto eth0

iface eth0 inet dhcp


auto eth0:1

iface eth0:1 inet static





What I needed it to be for the PYNQ board to use DHCP was just those first to lines, i.e.:

auto eth0

iface eth0 inet dhcp

The easiest way to do this was to just overwrite the file - after taking a copy of it first of course. The first time I tried it using sudo was enough but when I retried for this guide, I seemed to need su first. No idea why. Anyway, this is what I did to change the PYNQ to use DHCP. To be honest I'd have thought DHCP would have been the simplest default option for most people.

Switching PYNQ to DHCP

Linux gurus may know an even easier way. Feel free to let me know out in the comments. You should now find that on startup your PYNQ-Z2 board grabs an IP address and all you need to to from here on is go to http://pynq:9090 as in the guide.


A different fixed IP

DHCP worked for me, but if you'd rather assign a different fixed IP then you just need to swap out the IP address in eth0 for th eone you want. The easiest way is to use sed to do a search and replace. Try this, using whatever IP address you want. I chose in this example:

sed 's/' eth0


Ready to go

OK. I might do a little more reading up on Pynq, but at least I feel I'm ready to start the workshop...