The Pynq Z2 – A hobbyist’s review

The Pynq Z2 is a rather curious single-board computer. It has some very compelling features when compared to the Raspberry Pi, but it also has some major shortcomings. For a specific course I took at University, this board was recommended. Particularly, the course was on hardware design and that is where this board came in: It has an FPGA1 on board.

In this post, I will offer a brief exploration of the features the Pynq Z2 offers when combined with the Vivado software. This is by no means an extensive review. For example, the Python programming capabilities of the board will not be examined in detail (though from what I have seen they are not focused on the FPGA with support for custom designs). All of this will be done from a hobbyist perspective: How useful is it for your own projects?

Specifications

At $119 retail, the Pynq Z2 is a rather expensive singe-board computer. Not something you would buy unless you have a specific purpose in mind for it. But what purpose could it serve? Well, the specifications are very promising.

Processor: 650MHz dual-core Cortex A9
Memory: 512MiB DDR3 (16-bit bus, 8 DMA channels, 4 AXI3 Slave ports for communication with FPGA)
Video: HDMI-out (FPGA only)
Storage: micro-SD card
USB: USB host port (no USB-OTG on micro USB port!)
Ethernet: Gigabit, separate Realtek chip
GPIO: 28 FPGA IO, 6 single-ended inputs to 12-bit ADC
Low-bandwidth Interfaces: SPI, UART, CAN, I2C
High-bandwidth Interfaces: HDMI-in, HDMI-out
Miscellaneous: 24-bit I2S audio (FPGA only), audio line in
4 push buttons, 2 slide buttons, 4 green LEDs, 2 RGB LEDs

FPGA: Artix-7 equivalent with 13,300 logic slices, 6 input LUTs, 8 flip-flops, 630KiB RAM, 4 clock management tiles with PLL and MMCM, 220 DSP slices and XADC

Programming: UART over USB, JTAG, Quad-SPI Flash (16MB) or micro-SD

The Board

The board itself is rather large, measuring 13.6×8.7×2.0cm, including the protective rubber feet. The colour also makes the board hard to miss: It is a bright orangy pink. The Raspberry Pi and Arduino Uno compatible connectors immediately stand out, but also the amount of chips on this board is astonishing. There is the FPGA in the middle, the DDR3 memory on the right of it. In the top left is the ADAU1761 audio codec. Moving downwards again, we find an FTDI chip for serial communication over USB. Last but not least we find a TPS65400 power converter amid four inductors. At least, that’s the top of the board. On the bottom of the board there’s still more chips. There’s a Realtek chip for the Gigabit ethernet, a T1210B USB transceiver, an unidentifiable chip near the SD card slot, two more power converters and finally the 16MiB (128Mib) FL128SAIF00 SPI flash by SPANSION. The PCB is thick and sturdy at 2,0mm thickness and sports four mounting holes squarely in the corners of the board.

One can never have too many single-board computers.

A big letdown is the lack of documentation on the physical layout of the board. I was unable to find PCB board designs or even a blueprint that shows the distances between the connectors. This makes it extremely difficult to create your own PCBs to plug into the available headers, if not impossible. Such connections must be made with an extremely small margin, so only with a very accurate measuring tool and a huge amount of patience might one be able to determine what the PCB should look like. For a hobbyist who intends to use this board with custom PCB designs, this is a big problem.

Programming

Programming is where the Pynq Z2 shows off both its strengths and weaknesses. It’s very impressive specifications also are indicative of a serious problem for the hobbyist: They are rather complicated. Not many hobbyists will know what it means that there 220 DSP slices on the FPGA, if they even know what an FPGA is. The hardware is extremely impressive, but getting the most out of it is extremely hard. Accessing the IO requires programming, or more accurately designing logic for, the FPGA and thus a lot of specialist knowledge. However, as I took a course that involved the hardware design language Verilog, I played around with the basic features of the board quite a bit.

In order to make a proper hardware design, the software Vivado is required. Vivado is a full software suite that allows using Verilog to design logic for the FPGA, configure the system clocks and IOs and write C code to load the program into the FPGA and control it from the main ARM CPU. Access to this software is restricted: You won’t be able to get it if the US limits export of such technology to your country.

So, let’s assume you’ve installed Vivado, got it up and running and have a great idea for the hardware you want to design. While this is not a tutorial, let’s step through the basic steps involved to make your idea come to life. In this case, we use the example of a basic counter: The 4 programmable green LEDs will count up to 15 in binary and then reset again.

First, you create a Verilog module with your counter logic. If you take the time to practice Verilog a bit, more complicated designs will not be much more difficult than ‘normal’ programming. This module must be part of a bigger project: an AXI peripheral. Remember the AXI interfaces mentioned in the specifications? The AXI interface allows communication between the FPGA and other hardware on the board, including the ARM CPU and the LEDs. This interface is very fast and has a lot of configuration options. It is completely implemented in boilerplate generated Verilog, which makes it rather hard to understand without a big time investment. But let’s assume that this worked out fine as well.

The next step is to create a wrapper around your AXI peripheral. This wrapper will contain a hardware design with the clocks of the FPGA. There is an autosolver, which makes things go together rather easily in the hardware diagram. Now, there is yet more Verilog to edit to ensure that there is a connection between the whole FPGA and the AXI peripheral that contains your logic. The output pins that are supposed to drive the LEDs must be mapped to the actual hardware pins using a constraints file that secretly contains Tcl-code2. Okay, finally, we are done, right? We have our hardware design connected to an AXI peripheral interface, which in turn is connected to the FPGA block and all the clocks are configured. Oh, and the pins of our counter block are routed through three other Verilog modules so that they can be mapped to the LEDs.

The Vivado block diagram with the Zynq FPGA block and the custom counter IP. Configuring and exporting these in the right way is quite tricky.

Yes, we are done. Technically speaking at least. Depending on the options you chose in your hardware design, your LEDs may start blinking at this very moment. However, that is only if you do not want to use the ARM CPU in the mean-time. There are two options to use the ARM CPU: You can run Linux with all the non-realtimeness and ethernet-support, or you can choose to write your own C code that can be compiled and executed directly on the CPU. This is pretty much programming with a Hardware Abstraction Library (similar to programming the STM32 series, for example), but rather a complicated one. The ARM CPU has a lot of peripherals at its disposal and finding your way around all the registers and options will take a serious time investment for going over the interesting sections of the reference manual.

The real problem with the Zynq Z2 is that if you want to get into programming this FPGA, the reference manual is your only real companion. Even though it is intended as an educational board for learning FPGAs, it is clearly targeted at universities which provide specific courses for them. The board is too complex to be enjoyable to work with as a hobbyist. Vivado has hundreds of options, teensy little details you have to get right during setting up your project or they will be buried away in configuration files and Verilog is not easy to wrap your head around. Then, on top of all that, if you really want to harness the power of the board, you would have to write a Linux kernel driver for interfacing with the FPGA while accessing all the other peripherals using Linux.

Conclusion

The Pynq Z2 is a very impressive board, hardware-wise. I might even go so far as to say that it is as interesting as the BeagleBone Black. Its FPGA offers real potential and with the possibility of writing bare-metal C-code for the ARM CPU as well as Linux kernel drivers, I can see how this has real potential for testing video filters, basic oscilloscope design and other signal processing applications. However, from experience I can say that most Electrical Engineering bachelor students struggle with designing and programming the hardware for this board. There are lots of steps and it is difficult to change your design once you’ve moved on from one step to the next. It is certainly not impossible with a serious time investment and proper motivation. But, all in all, I think that only the Pynqs owned by people properly motivated by money (because itÅ› their job) will be the only people to see this board utilized in any real-life applications.

  1. Field Programmable Gate Array: An FPGA is a particular type of chip that contains hardware that can be programmed using designs that allow creation of real hardware circuits. This is useful for high-bandwidth applications (such as oscilloscopes) or for testing of particular hardware designs (such as {modules of} a new CPU or computational acceleration unit)
  2. Tcl is actually a real programming language. It is rather old, not used very much anymore and quite slow. Vivado uses a lot of Tcl-code for building and running the projects.
Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *