Testing Video Input of Hawkboard

From eLinux.org
Revision as of 04:09, 21 May 2010 by Alokprasad (Talk | contribs)

Jump to: navigation, search

Problem Description

OMAP L-138 kernels are supporting composite(camera) interface of Hawkboard out of the box, however there are 3 obstacles for using it:

  • L-138 VPIF video input offers camera data in 2 plane YUV format, namely NV16.
  • L-138 LCDC output, VGA output of Hawkboard, accepts display data in RGB565 format
  • L-138 does not have hardware support for converting NV16 <-> RGB565

Due to these problems, if we want to see camera input on the VGA output of the board we need to perform color conversion in the software.

Using Off-the-shelf Software Components

Currently GStreamer and Mplayer on the board and both were failed to capture camera input.


At the time of this writing, GStreamer v4l2 plugin, v4l2src, doesn't support NV16 format. Here is the output from 'gst-inspect v4l2src | grep NV' :

format: NV12
format: NV21

NV16 uses 4:2:2 sampling whereas NV12 uses 4:2:0.


MPlayer should support NV16 but right now doesnt work on Hawkboard. MPlayer was unable to find a suitable color format for camera.

Custom Solution

Since testing of camera with off-the-shelf components couldnt be performed,following solution could be used.

ARM only Solution

Make a V4L2 application, cross-compiled it and tried on the board. Results were:

  • Camera interface was functional.
  • Frame-rate was very low, maybe 3-4 fps.

ARM + DSP Solution

To increase the fps, modify the existing Codec Engine following examples:

  • video_copy application : This is the ARM side application capturing camera data and showing on the VGA display.
  • viddec_copy codec : This is the DSP codec doing the actual NV16 <-> RGB565 conversion.

This ARM + DSP solution that gives a 25 fps nice camera test on the hawkboard. You can find the binaries and source codes at [1]

Using Provided Binaries


When you download the provided vpi_example.tar.gz from the Hawkboard download page at code.google.com and extract it you will see the following files:

  • binaries
    • arm+dsp
      • all.x674
      • app_remote.xv5T
    • arm+only
      • camera-test
  • sources
    • arm+dsp
      • camera.patch
    • arm+only
      • .
      • .
      • .
  • uImage
Note : There might be a TVP5146 issue with hawkboard, such that TVP5146 being not detected by camera and throwing input setting errors. 
       To overcome this situation you could patch the kernel with the following patch. Patch can be downloaded from [2]

--- kernel_source_original/drivers/media/video/tvp514x.c        2010-03-18 14:33:44.000000000 +0200
+++ kernel_source/drivers/media/video/tvp514x.c 2010-05-07 00:46:05.284494625 +0300
@@ -741,8 +741,9 @@
-       if ((current_std == STD_INVALID) || (try_count < 0))
-               return -EINVAL;
+       if ((current_std == STD_INVALID) || (try_count < 0)) {
+               current_std = STD_PAL_BDGHIN;
+       }
        decoder->current_std = current_std;
        decoder->input = input;

Testing ARM only Code

Copy camera-test ARM-only binary somewhere in your filesystem on the board and run like any application:


No parameters are needed, program will open /dev/video0 and /dev/fb0 nodes, perform color conversion and you should see the results. You can find related source code in sources/arm-only' directory of the archive.

Testing ARM-DSP Code

First of all make sure that your CMEM and DSPLINK modules are loaded. If you are using an Angstrom file-system, make sure that your kernel is booted with mem=34M option so that CMEM module is automatically loaded. Also you can decrease necessary kernel buffer size with vpif_capture.ch0_bufsize=1658880 parameters. under U-Boot:

setenv bootargs 'console=ttyS2,115200n8 ubi.mtd=filesystem root=ubi0:hawkboard-rootfs rootfstype=ubifs mem=34M vpif_capture.ch0_bufsize=1658880'

If you need to load DSP modules by hand here is the necessary commands:

$insmod cmemk.ko phys_start=0xC2200000 phys_end=0xC3200000 pools=1x5250000,3x1048576,3x829440,1x256000,4x131072
$insmod dsplinkk.ko

Then copy both all.x674 and app_remote.xv5T binaries to the same folder and run the application with following commands:


Now you should see 25 fps video on your screen. Unfortunately, If you want to compile this example on your own, you will need whole Codec Engine tree. You will find a patch containing necessary changes in the sources/arm+dsp folder along with my own Makefile. If you are not using DVSDK and you have a working OpenEmbedded tree around you can use provided Makefile to compile this example.