How to Support RGB565 Gated Mode Input to i.MX6 CSI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Support RGB565 Gated Mode Input to i.MX6 CSI

How to Support RGB565 Gated Mode Input to i.MX6 CSI


These days I supported a customer to enable LVDS in function. The data format between external LVDS in chip and i.MX6 CSI is RGB565, with HSYNC and VSYNC signals available. So we take gated mode configuration for i.MX6 CSI.

Customer environment:  i.MX6 D  + Linux LTIB 4.0.0 BSP

By default,  RGB565 gated mode is not supported by Linux LTIB 4.0.0 V4L2 capture driver, here is a summary for what we need to change for the driver to support RGB565 gated mode.

  • Please apply the attached patch "0001-ENGR00262270-IPU3-Basic-16-bit-generic-data-support.patch". By this patch, IPU_PIX_FMT_GENERIC_16 can be supported by ipu3 driver.
  • For V4L2 capture setup, file linux-3.0.35/drivers/media/video/mxc/capture/mxc_v4l2_capture.c,  function mxc_v4l2_s_fmt(), add code segment like this:

                 switch(f->fmt.pix.pixelformat) {

                 ............................................................................

                 case V4L2_PIX_FMT_SGRBG8:

                          size = f->fmt.pix.width * f->fmt.pix.height * 2;

                          bytesperline = f->fmt.pix.width * 2;

                          break;

                 default:

                          break;

                 }

      

          Also for file linux-3.0.35/drivers/media/video/mxc/capture/ipu_csi_enc.c,  function csi_enc_setup(), please add code segment:

                 else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_SGRBG8)

                           pixel_fmt = IPU_PIX_FMT_GENERIC_16;

          By the modifications above, IPU_PIX_FMT_GENERIC_16 can be set for the CSI IDMAC channel.

  • For sensor driver, please set pixel format to IPU_PIX_FMT_GENERIC_16
  • Don't forget to set GATED MODE and data with to 16 bits for CSI param in file linux-3.0.35/drivers/media/video/capture/mxc_v4l2_capture.c, function mxc_v4l2_s_param

                csi_param.clk_mode = IPU_CSI_CLK_MODE_GATED_CLK;

                csi_param.data_width = IPU_CSI_DATA_WIDTH_16;

  • Please ensure CSI->MEM IDMAC channel should be choosed

     The key point is that for CSI RGB565 gated mode support, the pixel format for IDMAC channel should be set to GENERIC 16, and for CSI port configuration, the pixel format is BAYER mode.

Attachments
Comments

Dear Jun Zhu.

My environment is "i.MX 6D + ov5642 parallel camera"

I applied your above modificaitons including patch.

But, the overlay preview image is not normal. Its really greenish preview image (of course, i could see outline)  and there are 4 frames not 1 frame. (and rolling)

Is there another  point to modify?

And , I have additional question about your modification.

        for sensor driver, your mention was change the pixel format to IPU_PIX_FMT_GENERC_16. In my humble opinion, It sould be V4L2_PIX_FMT_SGRBG8 instead of IPU_PIX_FMT_GENERIC_16.

Please share your opinion.

Thank you.

BRs.

jessie.lee

Hi Hyeran.

Did you fix your probem ?

Hi Hyeran & huang:

I have similar problem like yours, i run the gstreamer pipeline to get capture result and show on screen, pipeline is like this:

gst-launch mfw_v4lsrc device=/dev/video0 capture-mode=4 ! mfw_v4lsink device=/dev/video16 sync=false

Can you give me some suggestions about how to fix it ? thanks

Share my experience to who have the same problem like Hyeran's and me, as below:

1. Change mfw_v4lsrc element default color format from V4L2_PIX_FMT_YUV420, to V4L2_PIX_FMT_SGRBG8

2. Change mfw_v4lsrc element default caps from video/x-raw-yuv to video/x-raw-rgb, default fourcc code from 'I' '4' '2' '0' to 'R' 'G' 'B' 'P'

3. After these changes, run pipeline to show on the screen, like this:

gst-launch mfw_v4lsrc device=/dev/video0 capture-mode=4 ! mfw_v4lsink device=/dev/video16 sync=false

thanks!

No ratings
Version history
Last update:
‎10-31-2013 01:46 AM
Updated by: