How to fix the color format for CSI Test generation mode

Showing results for 
Search instead for 
Did you mean: 

How to fix the color format for CSI Test generation mode

Contributor III

I am trying to capture the CSI test generated checkboard image on i.MX6 using GStreamer on Kernel 3.10.17. The doc I am using is Freescale BSP Porting Guide, Chapter 7.1.3 (Configuring the CSI Unit in Test Mode).

To enable the Capture mode, I've added the following settings in ipu_csi_init_interface function of drivers/mxc/ipu3/ipu_capture.c:

cfg_param.data_width = 0x1;

cfg_param.ext_vsync = 0x1;

cfg_param.data_fmt = 0x0;

cfg_param.pack_tight = 0x0;

cfg_param.clk_mode = 0x1;

cfg_param.pixclk_pol = 0x1;

cfg_param.data_pol = 0x0;

cfg_param.Hsync_pol = 0x0;

cfg_param.Vsync_pol = 0x0;

and called _ipu_csi_set_test_generator to setup clock and RGB values of squares in output the pattern:

_ipu_csi_set_test_generator(ipu, true, 255, 0, 0, uint32_t pixelClock = clk_get_rate(ipu->ipu_clk)/8, csi);

Note I have set /8 for the divider. If I omit the /8 division (which eventually causes the CSI0_DIV_RATIO to be set to zero, as the FSL Porting Guide have asked), it will caught in a loop and the dmesg shows (with DEBUG flag enabled) many "In MVC:camera_callback" message. With /8 division present, I can capture the test image by the following command, but their color seems to be incorrect:

gst-launch mfw_v4lsrc num-buffers=1 !  jpegenc ! filesink location=sample.jpeg

Here is an output image when I set 255,0,0 as RGB values for the test pattern:


And here is the one for 255,255,255:


I've adapted the OV5640 sensor driver (commented out I2C-related parts) and the sensor is recognized as v4l2 slave. The sensor pixelformat is set to

ov5640_data.pix.pixelformat = V4L2_PIX_FMT_YUYV;

in the ov5640_probe file. I've tried other video formats like V4L2_PIX_FMT_YYUV, V4L2_PIX_FMT_YVYU, etc, but they either caused "Internal data flow error" in Gstreamer or didn't make any difference.

It has been stated in BSP Porting guide:

Change the sensor pixel format from YUV to RGB565 in the ipu_bg_overlay_sdc.c file so that the image converter will not perform color space conversion and the input received from the CSI test mode generator will be sent directly to the memory.

I have tried changing the following settings to IPU_PIX_FMT_RGB565 in ipu_bg_overlay_sdc.c but that doesn't have any effect:

task.input.format = IPU_PIX_FMT_UYVY;  (csi_buf_work_func function)

pixel_fmt = IPU_PIX_FMT_UYVY; (csi_enc_callback function)

Labels (3)
0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport

Hi Issac,

    For RGB565 data, you should capture it by GENERIC mode .

    please refter to this link !



0 Kudos