This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4379: Video capture issue

Part Number: AM4379

Tool/software: Linux

My client has designed a custom board that uses an AM4379 processor to capture video from a Techwell TW9906 video decoder.

The TW9906 has eight data lines which are connected to CAM_0 through CAM_7 and the decoder's PCLK, VSYNC and HSYNC are also connected to their respective pins on the AM4379. On this design the decoder's I2C signals are routed to the AM4379's I2C2_SDA and I2C2_SCL pins.

I've configured the kernel according to the information contained within the "Linux Core VPFE User's Guide" and the “Kernel Configuration Options” section of the “Linux Core DSS User’s Guide”.

In the DTB I have the ti,am437x-vpfe-interface set equal to <1> and in the driver I have the follow format setting defaulted to:

format->width = 640;
format->height = 480;
format->code = MEDIA_BUS_FMT_UYVY8_2X8;
format->field = V4L2_FIELD_NONE;
format->colorspace = V4L2_COLORSPACE_SMPTE170M;

With these settings, I’m able to display a 640x480 image in black and white, but every other line is missing.

I would like to display every line and have the image in full color.

If I change format->field = V4L2_FIELD_INTERLACED; I get a blank screen.

If I change format->code = MEDIA_BUS_FMT_YUYV8_2X8; the image is displayed in shade of purple and green.

How do I configure the DTB and the driver to capture ITU-R 656 compatible YCbCr (4:2:2) interlaced video data and display it as a complete 640x480 full color image?

Gary

  • The software team have been notified. They will respond here.

    Please post what Linux version you are using.
  • Hi Biser,

    The Linux version is: 4.9.40

    Gary
  • Have you added the support in the decoder driver 

    Gary Teravskis said:
    How do I configure the DTB and the driver to capture ITU-R 656 compatible YCbCr (4:2:2) interlaced video data and display it as a complete 640x480 full color image?

    Are you wanting to capture in ITU-601 or ITU-R 656 format? Later is embedded sync format and doesn't need HSYNC, VSYNC signals. Also, the existing TW9906 driver in PLSDK 4.1 doesn't look to support DT or the v4l2 subdev asynchronous registration framework. Have you added those support by yourself?

    To use ITU-601 or basically discrete sync “ti,am437x-vpfe-interface” should be set to 0 for RAW interface. When setting “ti,am437x-vpfe-interface” to 1 then it expects that the video stream is using Embedded Sync (i.e. ITU-656).

    The subdevice driver has to correctly report which field type is being used either V4L2_FIELD_NONE, V4L2_FIELD_INTERLACED or V4L2_FIELD_SEQ_TB.

    The other thing to consider is also how the data pins are connected. If the TW9006 support both 8 and 10 bits output mode and if it is set to be in 8 bit mode, then it will actually output data on pin 2-9 instead of 0-7. When not hooked up properly (connecting pin 0-7 rather 2-9) , color degradation can be seen. 

  • Manisha,

    I have TW9906 device configured for ITU-610 and I have modified the decoder driver to register with the v4l2 framework.

    When I set ti,am437x-vpfe-interface = 0, I get a 640x480 image with the top half a solid green color and the bottom half is displaying camera video in shades of purple and green.

    If I set the field type to anything other than V4L2_FIELD_NONE then nothing gets displayed on the LCD.

    If I set ti,am437x-vpfe-interface = 1 and format->field = V4L2_FIELD_NONE; then a 640x480 video image in black and white is displayed on the LCD with every other line missing.

    I’m trying to reconcile your recommendation to connect the eight tw9906 output pins to pins 2-9 rather than what is described in the “AM437x ARM Cortex-A9 Processors Technical Reference Manual". Table 14-5 in section 14.3.1.1 on page 2146 shows the eight device outputs pins connected to vpfe signal pins 0-7.

    Please help me to understand this better.

    Gary
  • Both Techwell decoder and VIP should be configured to receive same frame type. Please check what field type is being reported by  decoder - V4L2_FIELD_NONE, V4L2_FIELD_INTERLACED or V4L2_FIELD_SEQ_TBI. VIP driver is not programmed to capture the interlace data in interleaved frame format. You need to program the width and height for field and not frame.

    Gary Teravskis said:
    I’m trying to reconcile your recommendation to connect the eight tw9906 output pins to pins 2-9 rather than what is described in the “AM437x ARM Cortex-A9 Processors Technical Reference Manual". Table 14-5 in section 14.3.1.1 on page 2146 shows the eight device outputs pins connected to vpfe signal pins 0-7.

    I meant connect t tw9906 output pins 2-9 to vpfe pins 0-7.

  • Manisha,

    I was able to fix the interlace problem by disabling OMAP DRM driver and enabling OMAP FB driver in the kernel source build.

    With <<< ti,am437x-vpfe-interface = 3 >>> in the DTB and <<< format->field = V4L2_FIELD_INTERLACED >>> in my TW9906 video driver, I'm now able to display a solid 640x480 de-interlaced black and white video image on my display. I'm completely satisfied with the video image quality except that it's in black and white. My client requires a full color image.

    Here are the settings I'm using in my driver:

    format->code = MEDIA_BUS_FMT_YUYV8_2X8;
    format->field = V4L2_FIELD_INTERLACED;
    format->colorspace = V4L2_COLORSPACE_JPEG;

    How do I setup the driver so that <<</bin/gst-launch-0.10 -ev v4l2src device=/dev/video0 ! ffmpedcolorspace ! fbdevsink device=/dev/fb0>>> displays a full color image?

    Thank you for your help.

    Gary
  • Okay, so it looks like you are saying that the problem is at Display side and not capture side. Please clarify on your requirement - Are you wanting to capture interlace input, de interlace it and then display the progressive (de-interlaced) content on monitor? So for VGA output, this means capturing 640x240 resolution fields, de-interlacing to 640x480 resolution and then display on 640x480 progressive monitor. Please clarify if this is correct requirement.
  • That is correct; however, I discovered the following solution:

    1) Set <<< ti,am437x-vpfe-interface = 3 >>> in the DTB

    2) Ignore the “Kernel Configuration Options” section of the “Linux Core DSS User’s Guide" and disable OMAP DRM driver in the kernel config. Instead enable the OMAP FB kernel driver in the kernel config and reference: (processors.wiki.ti.com/.../Dual_Frame_Buffer_on_OMAP35x) to properly setup the uboot bootargs for the new frame buffers.

    3) In the modified Techwell TW9906 video decoder driver set :
    format->code = MEDIA_BUS_FMT_UYVY8_2X8;
    format->field = V4L2_FIELD_INTERLACED;
    format->colorspace = V4L2_COLORSPACE_SMPTE170M;

    4) Use the following gstreamer pipeline:
    <<< /bin/gst-launch-0.10 -ev v4l2src device=/dev/video0 ! video/x-raw-yuv, format=\(fourcc\)UYVY ! ffmpegcolorspace ! fbdevsink device=/dev/fb0

    I'm now able to display a stable 640x480 de-interlaced full color video image on my display.
  • If the format field is set as interlace (format->field = V4L2_FIELD_INTERLACED;) and if the TW9906 decoder is streaming interlace video and there is no engine in your gstreamer pipeline doing de-interlacing, then something is wrong. This is because DSS driver doesn't support interlace display and you are seeing good output.

    I think if you set the TW9906 decoder to stream progressive video or insert a de-interlacing plugin in your gstreamer pipeline, you should see good output using DRM driver. This is the driver we recommend to use. The fbdev driver is simulation in omap drm driver and has very limited feature, more over we do not support it.