HowTo HDMI2PCIe on NeTV2 - timvideos/litex-buildenv GitHub Wiki

HDMI2PCIe on NeTV2 board

Introduction

This how-to guide is for people who want to run the HDMI2PCIe demo on NeTV2 boards.

The HDMI2PCIe demo allows the user to both stream and capture raw HDMI Video frames with the help of a PCIe link to a host Linux PC.

You will need:

  • a Linux PC with a NeTV2 board plugged into a PCIe slot (host PC).
  • a second laptop/PC running Linux.
  • a USB-UART adapter attached to serial pins on the NeTV2 board and to the second Linux machine using USB.
  • a JTAG adapter attached to the JTAG pins on the NeTV2 board and to the second Linux machine using USB.

All shell commands in this guide use bash.

Gateware and Firmware

To build Gateware for the board you need to use PLATFORM=netv2 and TARGET=hdmi2pcie. The Firmware was tested with only VexRiscv as the Soft CPU but it should work on all supported CPUs.

After building the gateware and firmware targets you can either flash the board with the gateware using a top.bin file or load it using top.bit. Safest way to load the bitstream is to stop the PC in the bootloader and then load the gateware over JTAG.

After the gateware is loaded you should be able to access the BIOS prompt via a USB-UART adapter.

Using lxterm --speed 115200 /dev/ttyUSB0 --kernel <path to firmware.bin>/firmware.bin you should be able to load the HDMI2USB firmware, which supports PCIe features, over a serial link.

Linux driver

A Linux driver is located inside the software/hdmi2pcie/kernel/ subdirectory, this directory needs to be placed on the host PC. The host PC must have the Linux headers and development tools (gcc, make) installed.

If you have all the dependencies installed you should be able to build the driver by executing make inside the kernel directory. After that you can load it with insmod netv2.ko.

After successfully loading the kernel module, a device file named /dev/netv20/ should appear.

Accessing the HDMI buffers over PCIe

To access input and output buffers, first you need to configure the HDMI2USB firmware running on the NeTV2 ie. connect the HDMI inputs and outputs to PCIe using the x c commands. After that, it should be possible to access the buffers using software/hdmi2pcie/user/hdmi2pcie.py.

The Linux driver operates on raw UYVY frames, to send a raw frame to the device and display it execute ./hdmi2pcie.py -f <raw frame file>.

To grab a raw frame from the connected input run ./hdmi2pcie.py -f <output file path> -r -b 3 -x <image width> -y <image height>.

To convert to and from UYVY you can use ImageMagick.