FPGA Applications

Numato Opsis: Getting Started With HDMI2USB Firmware On Opsis On Linux

1738 views June 30, 2016 admin 1

opsisproduct-focus_jpg_project-body

Introduction

HDMI2USB is a firmware project that can run for Numato Opsis FPGA based open video platform. This firmware enables Opsis to capture or generate HDMI, DVI or DisplayPort (future) video. The captured video can be transferred to host PC through the USB interface available. With HDMI2USB firmware programmed, Opsis shows up on the host PC as a standard webcam, so no additional drivers required on Linux to use the basic functionality. This article will discuss how to program and use HDMI2USB firmware on Numato Opsis FPGA based video platform. HDMI2USB is capable of capturing HDMI streams from 2 sources and routing them to 3 possible locations, USB or the 2 HDMI output ports present on Opsis. Currently though, HDMI2USB  doesn’t support DisplayPort capture. It is a work that is still in progress.

complex-setup_png_project-body

HDMI2USB Opsis Application. Image copyright: Katie McLaughlin @glanst, CC-BY-SA

Prerequisites

To follow this article, you will need:

  • Hardware:
    • Numato Opsis FPGA based video platform
    • USB 2.0 B-type cable
    • DC power Supply(12V)
    • 2x HDMI Cables (exact number depends on your application)
    • A separate monitor with HDMI input
    • An HDMI Source (Laptop/PC/Raspberry Pi etc)
  • Software:
    • Linux (Author used Ubuntu 14.04 running on a virtual machine)
  • Good internet connectivity

Connections:

For this article, we will use a configuration as shown below.  HDMI2USB on Opsis can handle more complex configurations but we will use a simple configuration now.

simple-setup_png_project-body

HDMI2USB Opsis Connections. Image copyright: Katie McLaughlin @glanst, CC-BY-SA

  • Connect an HDMI source to HDMI IN 1 of Opsis
  • Connect an HDMI cable from HDMI OUT 1 of Opsis to monitor

Here HDMI source refers to devices capable of HDMI output like laptop, desktop, Raspberry Pi, another Opsis etc. And sink refers to devices capable of receiving HDMI signals like monitors, yet another Opsis etc.

In the author’s case, the host PC was connected to a monitor using VGA interface. So, that left a spare HDMI output on the same PC which was connected to HDMI IN 1 on Opsis.

HDMI OUT 1 of Opsis was connected to another monitor. A USB cable was connected from host PC to Opsis. And finally Opsis was powered up using a 12V external power supply.

Getting started:

As soon as Opsis is powered up, the monitor connected to HDMI OUT 1 will start showing a color bar pattern (unless the factory-programmed with HDMI2USB firmware is not altered).

Step 1: Ubuntu 14.04 already ships with appropriate drivers for HDMI2USB on Opsis. But, we do need to set up proper permissions for accessing it without requiring root privileges. Execute the following commands on the prompt:

wget https://github.com/timvideos/HDMI2USB-misoc-firmware/raw/master/scripts/52-hdmi2usb.rules
sudo cp 52-hdmi2usb.rules /etc/udev/rules.d/

Step 2: As soon as Opsis is plugged in to the USB port, Linux will detect it and assign assign drivers for it, as shown in dmesg output below. Note that HDMI2USB’s the serial port is assigned to “/dev/ttyACM0” and HDMI2USB UVC device shows up as “/dev/video0” under “/dev” directory.

hdmi2usb_opsis_dmesg_drivers

dmesg output

hdmi2usb_devfiles

Device file entries of our interest under /dev directory

The exact device names can vary depending on if there are other similar devices already connected on your system.

Step 3: Install any serial terminal program of your choice. We will install PuTTY in our case, but any serial terminal program should work just fine.

 sudo apt-get install putty

Step 4: Run PuTTY and ennter the serial port, which in our case is “/dev/ttyACM0”, and set the baudrate as 115200.putty_ubuntu

Now, before clicking “Open” button, go to “Terminal” tab and check “Implicit CR in every LF”.putty_terminal

We can now open the port by clicking the “Open” button.

Step 5: If everything went well, we will see a blank PuTTY screen. Press ENTER key to get the HDMI2USB prompt as shown in the image below:putty_hdmi2usb_prompt

Step 6: Type “help” and press Enter to see a list of supported commands. With the help of these commands, we can control and debug HDMI2USB.hdmi2usb_help

Step 7: Type “status” on your serial terminal to know the status of HDMI2USB firmware as shown in the picture below:hdmi2usb_status

As we can see in the picture above, input0 is being correctly detected (This input is connected to HDMI source). Since we didn’t connect anything to input1, no input signal is detected as expected. Also, output0 and output1 are enabled and showing “pattern” (This means signal for these outputs are generated from a built in pattern generator ). Encoder is also enabled but no host program is currently streaming video through USB hence 0Mbps data rate shown.

Step 8: Now we can connect input(source) to output(sink) by using the following command:

video_matrix connect <source> <sink>

source can be: input0, input1 or pattern

sink can be: output0, output1 or encoder

The illustration below will make this much clearer:

video_matrix

So, lets connect output0 to input0.

video_matrix connect input0 output0

This command will casue output0 (ie HDMI OUT 1) to display whatever the Opsis board is receiving at input0 (HDMI IN 1). And in our case, signal at input0 (HDMI IN 1) is coming from host PC’s HDMI output. Windows on host PC will detect Opsis as another display and it will automatically set the resolution, by default, to 1280×720. We can clone the existing display or extend the display. In our case, Windows has been set up to extend the display. (Linux VM is running on Windows host)
hdmi2usb_connect_input0_output0

So, we will now get the extended Windows Desktop on the monitor which was connected to HDMI OUT 1

Step 9: To view the stream through USB interface, we will need to install software such mplayer, vlc etc. Here let us install mplayer by executing the command below.

sudo apt-get install mplayer

Step 10: View the USB video stream using mplayer using following command (make sure to change the device name if needed).

mplayer tv:// -tv driver=v4l2:width=1280:height=720:device="/dev/video0" -vf screenshot -vo xv

We will see the default pattern as below. This is because the encoder is still connected to pattern generator. We will need to connect input0 to the encoder so we can stream the video from input0 through USB.

hdmi2usb_mplayer_pattern

So, lets try connecting encoder to input0 so that we can view our extended desktop back into our PC.

video_matrix connect input0 encoder

hdmi2usb_connect_input0_encoder

Now we will get a nice live capture of our extended desktop through mplayer (as shown in screenshot below) :

hdmi2usb_usb_capture

Conclusion

This was just basic introduction on how to use HDMI2USB firmware with Numato Opsis. HDMI2USB is capable of doing much more and the continuous development is expected to bring even more features to the table. This article demonstrates how easy it is to setup and use HDMI2USB firmware with Numato Opsis FPGA based video platform.

Was this helpful?

Leave A Comment
*
*