#4 Pynq Virtural Environment
Table of Contents
1 Pynq is virtual environment
Pynq is clever designed to support AMD-Xilinx platform without efforts on climbing knowledge cliff for FPGA principles. Pynq is opensourced and support Zynq|Zynq Ultrascale+ platforms likr Ultra96, ZCU104 etc. For Spantan, the resource is limited, for Alveo only in Host OS mode since they are PCI cards. Pynq can be ported to compatible boards.
In most cases, download pynq SD card image to boot the board can start the pynq in jupyter notebook mode. The ipython mode is jupyter lab supported instead of jupyter notebook. The pynq is virtual enviornment. Any python package shall be installed in Pynq, or else it is not accessible.
According to the develop flow, petalinux build one SD card image and include pynq as one package. After booting, pynq is started and ready to be visit in http callbacks. Pynq provide overlay to import bitstream files to after bootup. DPUs built by vitis AI, is compile into binary file, to be included in pynq overlays.
Try times and times with DPU-Pynq installation, it comes that Pynq-z1 is not supporting DPU, as https://discuss.pynq.io/t/dpu-pynq-now-available-for-zu-and-rfsoc-devices/1251 only applicable to Zynq Ultrascale+ in recent Pynq versions.
2 Arty Z7 and pynq overlay
The reason to used pynq is Arty Z7 is pin to pin compatible with Pynq-z1, the documents can be shared. Pynq-z2 can be used as well if audio is not used. Both Arty Z7, pynq-z1 and pynq-z2 shal Zynq-7020 core, an SOC based on a dual-core ARM® Cortex®-A9 processor (referred to as the Processing System or PS), integrated with FPGA fabric (referred to as Programmable Logic or PL). The PS subsystem includes a number of dedicated peripherals (memory controllers, USB, Uart, IIC, SPI etc) and can be extended with additional hardware IP in a PL Overlay.
PYNQ provides a Python interface to allow overlays in the PL to be controlled from Python running in the PS. Base overlay includes,
- HDMI (Input and Output)
- Microphone in
- Audio out
- User LEDs, Switches, Pushbuttons
- 2x Pmod PYNQ MicroBlaze
- Arduino PYNQ MicroBlaze
- 3x Trace Analyzer (PMODA, PMODB, ARDUINO
Besides, there are logictools overlays, for external digital logic circuit.
Loading overlay is simple in Pynq python
from pynq import Overlay
overlay = Overlay("base.bit")
The overlay is then imported with predefined Interface APIs.
3 Pynq setup in Arty Z7
Download Pynz-z1 image and flash to SD card, insert the SD card into the slot,
Plug RJ-45 cord, connecting ethernet,
Change IP of host computer within 192.168.2.x
Setting Jumpers to select the power source USB or 12V external power adapter
Wait a while for booting up.
Visit 192.168.2.99 from host computer, the pynq interface is ready.
input password 'xilinx' to enter,
The pynq virtual enviornment can be access from serial port
4 iPython and coding
Create new terminal, into pynq enviornment,
browse for packages installed, eg., library vitis XRT is install for PCI cards
There is the script start pynq environment
The vart is not installed and quite a lot packages is missing in this version of Pynq,
Go back to ipython to run overlays one by one to be familiar with them,
Public python packages can be installed as normal python, since this is based on ubuntu jammy , command like apt, apt-get both can be used as package manager.
5 Summary
This blog briefs the pynq environment and how to use them. This is not easy to install vitis library instantly. I have tried with older version of Pynq in PYNQ-Z1 board. The dpu is build into binary file dpu.xclib to be imported as overlay. I could not find it in newer version.
Thera are still ways to run the person detection on this boards. And I shall try it on.