====== Zybo Z7 Petalinux Demo ======
=== Under Construction ===
===== Description =====
The Zybo Z7 Petalinux demo demonstrates the usage of various board features from within a Linux environment.
Available features:
* Ethernet with Unique MAC address and DHCP support
* USB Host support
* UIO drivers for onboard switches, buttons and LEDs
* SSH server
* Build essentials package group for on-board compilation using gcc, etc.
* HDMI output with KMS (kernel mode setting)
* HDMI input via UIO drivers
* Audio output
* Audio input
* Pcam 5C input via V4L2 drivers
----
===== Inventory =====
* Zybo Z7 (-10 or -20) with a MicroUSB Programming Cable (and external Power Supply)
* Vivado installation compatible with the latest release of this demo (2020.1)
* //See [[programmable-logic:guides:installing-vivado-and-vitis|Installing Vivado, Vitis, and Digilent Board Files]] for installation instructions.//
* Vivado and Vitis installations compatible with the latest release of this demo (2020.1)
* //See [[programmable-logic:guides:installing-vivado-and-vitis|Installing Vivado, Vitis, and Digilent Board Files]] for installation instructions.//
* Petalinux Installation compatible with the latest release of this demo (2020.1)
* //See Xilinx's [[https://docs.xilinx.com/v/u/2020.1-English/ug1144-petalinux-tools-reference-guide|Petalinux Tools Documentation (2020.1) (UG1144)]] for isntallation instructions.//
* Serial Terminal application to receive messages printed by the demo
* //See [[programmable-logic:guides:serial-terminals:start]] for more information.//
* Pcam 5C to use video for Linux functionality
----
===== Download and Usage Instructions =====
First and foremost, releases - consisting of a set of files for download - are only compatible with a specific version of the Xilinx tools, as specified in the name of the release (referred to as a //release tag//). In addition, releases are only compatible with the specified variant of the board. For example, a release tagged "20/DMA/2020.1" for the Zybo Z7 is only to be used with the -20 variant of the board and Vivado 2020.1.
The latest release version for this demo is highlighted in green.
**Note:** //Releases for FPGA demos from before 2020.1 used a different git structure, and used a different release tag naming scheme.//
^ Board Variant ^ Release Tag ^ Release Downloads ^ Setup Instructions ^
| Zybo Z7-20 | @#C0EEBD: (tag) | [[https://github.com/Digilent/(Board)/releases/tag/(tag)|Release ZIP Downloads]] | See //Using the Latest Release//, below |
| Zybo Z7-10 | @#C0EEBD: (tag) | [[https://github.com/Digilent/(Board)/releases/tag/(tag)|Release ZIP Downloads]] | See //Using the Latest Release//, below |
| Zybo Z7-20 | v2017.4-3 | [[https://github.com/Digilent/Petalinux-Zybo-Z7-20/releases/tag/v2017.4-3|Release ZIP Downloads]] | [[https://github.com/Digilent/Petalinux-Zybo-Z7-10/tree/v2017.4-3|Github README]] |
| Zybo Z7-10 | v2017.4-1 | [[https://github.com/Digilent/Petalinux-Zybo-Z7-10/releases/tag/v2017.4-1|Release ZIP Downloads]] | [[https://github.com/Digilent/Petalinux-Zybo-Z7-10/tree/v2017.4-1|Github README]] |
| Zybo Z7-20 | v2017.2-1 | [[https://github.com/Digilent/Petalinux-Zybo-Z7-20/releases/tag/v2017.2-1|Release ZIP Downloads]] | [[https://github.com/Digilent/Petalinux-Zybo-Z7-20/tree/v2017.2-1|Github README]] |
| Zybo Z7-10 | v2017.2-1 | [[https://github.com/Digilent/Petalinux-Zybo-Z7-10/releases/tag/v2017.2-1|Release ZIP Downloads]] | [[https://github.com/Digilent/Petalinux-Zybo-Z7-10/tree/v2017.2-1|Github README]] |
**Note for Advanced Users:** //All demos for the Zybo Z7 are provided through the [[https://github.com/Digilent/Zybo-Z7|Zybo Z7]] repository on Github. Further documentation on the structure of this repository can be found on this wiki's [[programmable-logic:documents:git]] page.//
----
Instructions on the use of the latest release can be found in this dropdown:
--> Using the Latest Release #
{{page>programmable-logic:guides:using-github-releases#petalinux_release_before_programming&noheader}}
--> Set up the Zybo Z7-20 #
Attach the Pcam 5C assembly (which includes the Pcam 5C and the attached 15-pin flat flexible cable) by inserting the other end of the FFC into the Pcam connector on the Zybo Z7 as shown in image below. Ensure the cable is securely latched by pressing down firmly on the connector with two fingers. For a more detailed set of instructions, see the Pcam section in the [[programmable-logic:zybo-z7:reference-manual#pcam_port|Zybo Z7 Reference Manual]]. If the cable has become disconnected from the Pcam 5C, please see the [[add-ons:pcam-5c:reference-manual|Pcam 5C reference manual]] for instructions on how to reattach it.
{{:reference:programmable-logic:zybo-z7:zybo-z7-pcam-attach.png|}}
----
<--
{{page>programmable-logic:guides:using-github-releases#petalinux_release_programming&noheader}}
At this point, the demo is now running on your board. Refer to the [[#description|Description]] section of this document for more information on what it does.
<--
----
A brief set of instructions to some of the configurations which can be done in Petalinux can be found in this dropdown:
--> Petalinux Configurations #
{{page>programmable-logic:guides:using-github-releases#petalinux_configurations&noheader}}
<--
----
===== Using the demo =====
--> Taking pictures using V4L2 and the Pcam 5C (Z7-20 only) #
Run the following commands in the serial console connected to your board.
Set the width, height, and framerate of your capture.
width=1920 && height=1080 && rate=15
Prepare your media and video pipeline.
media-ctl -d /dev/media0 -V '"ov5640 2-003c":0 [fmt:UYVY/'"$width"x"$height"'@1/'"$rate"' field:none]'
media-ctl -d /dev/media0 -V '"43c60000.mipi_csi2_rx_subsystem":1 [fmt:UYVY/'"$width"x"$height"' field:none]'
v4l2-ctl -d /dev/video0 --set-fmt-video=width="$width",height="$height",pixelformat='YUYV'
Capture 14 frames.
yavta -c14 -f YUYV -s "$width"x"$height" -F /dev/video0
==Warning==
The camera module takes some time to automatically adjust the exposure and white balance. While this is happening, the frames will come out dark and with green tints. Capture more frames than needed for your usecase.
<--
--> Retrieving the pictures #
Run the following commands in a terminal on your Linux machine.
Copy the .bin files produced by the capture commands from the board to your machine via SSH.
Replace 10.113.0.117 with your board's IP address.
scp root@10.113.0.117:~/*.bin .
You can find the IP address of your board by running the following command in your serial console.
ip addr show
Set the width, height, and framerate of your capture.
width=1920 && height=1080 && rate=15
Using ffmpeg, convert the files you copied into PNG.
for f in *.bin; do mv "$f" "${f%.bin}.yuv"; done
for f in *.yuv; do ffmpeg -s "$width"x"$height" -pix_fmt yuyv422 -i "$f" -y "${f%.yuv}.png"; done
<--
--> Audio input / output #
Run the following commands in the serial console connected to your board.
Start a pulseaudio server.
pulseaudio --start
If you see a message similar to the following one, you need to start the pulseaudio server again.
ALSA lib ../../alsa-plugins-1.1.9/pulse/pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused
See the [[https://alsa-project.org/wiki/SoundcardTesting|Soundcard Testing]] page of the ALSA project to find out how to capture and play back sound.
<--
----
===== Additional Resources =====
All materials related to the use of the Zybo Z7 can be found on its [[..:start|Resource Center]].
All materials related to the use of the Pcam 5C can be found on its [[add-ons:pcam-5c:start|Resource Center]].
For additional and in-depth information about how Petalinux works please consult the [[https://docs.xilinx.com/v/u/2020.1-English/ug1144-petalinux-tools-reference-guide|UG1144 v.2020.1]]
For technical support, please visit the [[https://forum.digilentinc.com/forum/27-embedded-linux/|Embedded Linux]] section of the Digilent Forum.
----
{{tag>project zybo-z7}}