AnsweredAssumed Answered

How to attach MIPI CSI-2 camera to i.MX6S

Question asked by kilsu hong on May 20, 2015
Latest reply on Jun 2, 2015 by Wigros Sun

Dear,

 

I have been attaching camera ISP to our customized board based on i.MX6solo sabresd.

The camera ISP is connected to Freescale chipset with MIPI CSI-2, 2 lanes.

So, I modified some configurations like below,

 

===================================================================================

static struct fsl_mxc_capture_platform_data capture_data[] = {

     {

          .csi = 0,

          .ipu = 0,

          .mclk_source = 0,

          .is_mipi = 1,

     },

};

 

static struct mipi_csi2_platform_data mipi_csi2_pdata = {

          .ipu_id  = 0,

          .csi_id = 0,

          .v_channel = 0,

          .lanes = 2,

          .dphy_clk = "mipi_pllref_clk",

          .pixel_clk = "emi_clk",

};

====================================================================================

 

 

after booting, I tried to execute mxc_v4l2_capture.out, but the error message was occurred

 

====================================================================================

root@freescale /unit_tests$ ./mxc_v4l2_capture.out -i 1 -d /dev/video0 -iw 1920 -ih 1080 -ow 1920 -oh 1080 -m 1

in_width = 1920, in_height = 1080[ioctl_g_ifparm] clock_curr=mclk=24000000

 

 

out_width = 1920, out_height = 1080

top = 0, left = 0

[ioctl_s_power] ioctl_s_power is called

[ioctl_init] ioctl_init is called

mipi csi2 enabled!

[ioctl_dev_init] ioctl_dev_init is called

sensor chip is m5mols_mipi_camera[ioctl_s_parm] ioctl_s_parm is called (type: 1)

 

 

sensor supported frame size:

[mipi_csi2_set_lanes] mipi lane setting: 2 lanes

128x96

160x120

176x144

176x176

240x320

320x240

240x400

400x240

352x288

480x360

640x360

640x480

720x480

800x480

800x600

1280x720

1[m5mols_init_mode] mipi_csi2_dphy_status = 0x200

920x1080

3264x2448

800x602

320x240

400x240

480x360

640x360

640x480

800x480

1280x720

1280x960

1600x1200

1920x1080

2048x1152

2048x1536

2560x1440

2560x1536

2560x1[m5mols_init_mode] mipi_csi2_dphy_status = 0x200

920

3264x1836

3264x1960

3264x2448

24944x28018

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P[m5mols_init_mode] mipi_csi2_dphy_status = 0x300

 

 

sensor frame format: 422P

sens[m5mols_init_mode] mipi_csi2_get_error1 = 0x0

or frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame [ioctl_g_ifparm] clock_curr=mclk=24000000

format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

sensor frame format: 422P

         Width = 1920    Height = 1080   Image size = 3110400

         pixelformat = 842093913

[ipu_get_soc] ipu id: 0, ipu_array[0].online: 1

[ipu_init_channel] mipi enable? --> 1

[ipu_init_channel] ipu_conf = 0x100006a0

[ipu_enable_csi] csi_use_count[0] = 1, csi = 0

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

VIDIOC_DQBUF failed.

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

VIDIOC_QBUF failed[_ipu_csi_wait4eof] channel: CSI_MEM0

 

 

[ipu_get_soc] ipu id: 0, ipu_array[0].online: 1

[ioctl_s_power] ioctl_s_power is called

====================================================================================

 

Here is my dmesg

====================================================================================

In MVC: mxc_v4l_open

   device name is Mxc Camera

[ioctl_g_ifparm] clock_curr=mclk=24000000

End of mxc_v4l_open: v2f pix widthxheight 288 x 352

End of mxc_v4l_open: crop_bounds widthxheight 1920 x 1080

End of mxc_v4l_open: crop_defrect widthxheight 1920 x 1080

End of mxc_v4l_open: crop_current widthxheight 1920 x 1080

On Open: Input to ipu size is 1920 x 1080

[ioctl_s_power] ioctl_s_power is called

[ioctl_init] ioctl_init is called

mipi csi2 enabled!

[ioctl_dev_init] ioctl_dev_init is called

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c5651

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c02c564a

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0405602

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0cc5616

   case VIDIOC_S_PARM

In mxc_v4l2_s_param

   Current capabilities are 1001

   Current capturemode is 0  change to 1

   Current framerate is 30  change to 30

[ioctl_s_parm] ioctl_s_parm is called (type: 1)

[mipi_csi2_set_lanes] mipi lane setting: 2 lanes

[m5mols_init_mode] mipi_csi2_dphy_status = 0x200

[m5mols_init_mode] mipi_csi2_dphy_status = 0x200

[m5mols_init_mode] mipi_csi2_dphy_status = 0x300

[m5mols_init_mode] mipi_csi2_get_error1 = 0x0

[ioctl_g_ifparm] clock_curr=mclk=24000000

   clock_curr=mclk=24000000

   g_fmt_cap returns widthxheight of input as 1920 x 1080

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0045627

   case VIDIOC_S_INPUT

In MVC:mxc_streamoff

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c014563b

   case VIDIOC_G_CROP

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl 4014563c

   case VIDIOC_S_CROP

   Cropping Input to ipu size 1920 x 1080

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0cc5605

   case VIDIOC_S_FMT

In MVC: mxc_v4l2_s_fmt

   type=V4L2_BUF_TYPE_VIDEO_CAPTURE

End of mxc_v4l2_s_fmt: v2f pix widthxheight 1920 x 1080

End of mxc_v4l2_s_fmt: crop_bounds widthxheight 1920 x 1080

End of mxc_v4l2_s_fmt: crop_defrect widthxheight 1920 x 1080

End of mxc_v4l2_s_fmt: crop_current widthxheight 1920 x 1080

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c008561c

   case VIDIOC_S_CTRL

In MVC:mxc_v4l2_s_ctrl

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0145608

   case VIDIOC_REQBUFS

In MVC:mxc_streamoff

MVC: In mxc_free_frame_buf

In MVC:mxc_allocate_frame_buf - size=3110400

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0cc5604

   case VIDIOC_G_FMT

In MVC: mxc_v4l2_g_fmt type=1

   type is V4L2_BUF_TYPE_VIDEO_CAPTURE

End of mxc_v4l2_g_fmt: v2f pix widthxheight 1920 x 1080

End of mxc_v4l2_g_fmt: crop_bounds widthxheight 1920 x 1080

End of mxc_v4l2_g_fmt: crop_defrect widthxheight 1920 x 1080

End of mxc_v4l2_g_fmt: crop_current widthxheight 1920 x 1080

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0445609

   case VIDIOC_QUERYBUF

In MVC:mxc_v4l2_buffer_status

In MVC:mxc_mmap

   pgoff=0x18800, start=0x2ade3000, end=0x2b0db000

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0445609

   case VIDIOC_QUERYBUF

In MVC:mxc_v4l2_buffer_status

In MVC:mxc_mmap

   pgoff=0x18c00, start=0x2b188000, end=0x2b480000

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0445609

   case VIDIOC_QUERYBUF

In MVC:mxc_v4l2_buffer_status

In MVC:mxc_mmap

   pgoff=0x19000, start=0x2b50f000, end=0x2b807000

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c044560f

   case VIDIOC_QBUF

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c044560f

   case VIDIOC_QBUF

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c044560f

   case VIDIOC_QBUF

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl 40045612

   case VIDIOC_STREAMON

In MVC:mxc_streamon

[ipu_get_soc] ipu id: 0, ipu_array[0].online: 1

imx-ipuv3 imx-ipuv3.0: init channel = 15

[ipu_init_channel] mipi enable? --> 1

[ipu_init_channel] ipu_conf = 0x100006a0

imx-ipuv3 imx-ipuv3.0: initializing idma ch 0 @ a08c0000

imx-ipuv3 imx-ipuv3.0: ch 0 word 0 - 00000000 FD200000 004F1A00 E0000000 0010DCEF

imx-ipuv3 imx-ipuv3.0: ch 0 word 1 - 03280000 00650000 0047C000 0001DFC0 000003BF

imx-ipuv3 imx-ipuv3.0: PFS 0x2,

imx-ipuv3 imx-ipuv3.0: BPP 0x0,

imx-ipuv3 imx-ipuv3.0: NPB 0x1f

imx-ipuv3 imx-ipuv3.0: FW 1919,

imx-ipuv3 imx-ipuv3.0: FH 1079,

imx-ipuv3 imx-ipuv3.0: EBA0 0x19400000

imx-ipuv3 imx-ipuv3.0: EBA1 0x19400000

imx-ipuv3 imx-ipuv3.0: Stride 1919

imx-ipuv3 imx-ipuv3.0: scan_order 0

imx-ipuv3 imx-ipuv3.0: uv_stride 959

imx-ipuv3 imx-ipuv3.0: u_offset 0x1fa400

imx-ipuv3 imx-ipuv3.0: v_offset 0x278d00

imx-ipuv3 imx-ipuv3.0: Width0 0+1,

imx-ipuv3 imx-ipuv3.0: Width1 0+1,

imx-ipuv3 imx-ipuv3.0: Width2 0+1,

imx-ipuv3 imx-ipuv3.0: Width3 0+1,

imx-ipuv3 imx-ipuv3.0: Offset0 31,

imx-ipuv3 imx-ipuv3.0: Offset1 29,

imx-ipuv3 imx-ipuv3.0: Offset2 0,

imx-ipuv3 imx-ipuv3.0: Offset3 0

[ipu_enable_csi] csi_use_count[0] = 1, csi = 0

imx-ipuv3 imx-ipuv3.0: IPU_CONF =       0x100007A1

imx-ipuv3 imx-ipuv3.0: IDMAC_CONF =     0x0000002F

imx-ipuv3 imx-ipuv3.0: IDMAC_CHA_EN1 =  0x00800001

imx-ipuv3 imx-ipuv3.0: IDMAC_CHA_EN2 =  0x00000000

imx-ipuv3 imx-ipuv3.0: IDMAC_CHA_PRI1 =         0x18800001

imx-ipuv3 imx-ipuv3.0: IDMAC_CHA_PRI2 =         0x00000000

imx-ipuv3 imx-ipuv3.0: IDMAC_BAND_EN1 =         0x00000000

imx-ipuv3 imx-ipuv3.0: IDMAC_BAND_EN2 =         0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_CHA_DB_MODE_SEL0 =   0x00000001

imx-ipuv3 imx-ipuv3.0: IPU_CHA_DB_MODE_SEL1 =   0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_CHA_TRB_MODE_SEL0 =  0x00800000

imx-ipuv3 imx-ipuv3.0: IPU_CHA_TRB_MODE_SEL1 =  0x00000000

imx-ipuv3 imx-ipuv3.0: DMFC_WR_CHAN =   0x00000090

imx-ipuv3 imx-ipuv3.0: DMFC_WR_CHAN_DEF =       0x202020F6

imx-ipuv3 imx-ipuv3.0: DMFC_DP_CHAN =   0x0000968A

imx-ipuv3 imx-ipuv3.0: DMFC_DP_CHAN_DEF =       0x2020F6F6

imx-ipuv3 imx-ipuv3.0: DMFC_IC_CTRL =   0x00000002

imx-ipuv3 imx-ipuv3.0: IPU_FS_PROC_FLOW1 =      0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_FS_PROC_FLOW2 =      0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_FS_PROC_FLOW3 =      0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_FS_DISP_FLOW1 =      0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_VDIC_VDI_FSIZE =     0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_VDIC_VDI_C =         0x00000000

imx-ipuv3 imx-ipuv3.0: IPU_IC_CONF =    0x00000000

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c0445611

   case VIDIOC_DQBUF

In MVC:mxc_v4l_dqueue

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl c044560f

   case VIDIOC_QBUF

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

In MVC:mxc_v4l_ioctl

In MVC: mxc_v4l_do_ioctl 40045613

   case VIDIOC_STREAMOFF

In MVC:mxc_streamoff

[_ipu_csi_wait4eof] channel: CSI_MEM0

imx-ipuv3 imx-ipuv3.0: CSI stop timeout - 5 * 10ms

[ipu_get_soc] ipu id: 0, ipu_array[0].online: 1

In MVC:mxc_free_frames

In MVC:mxc_v4l_close

In MVC:mxc_streamoff

[ioctl_s_power] ioctl_s_power is called

mxc_v4l_close: release resource

MVC: In mxc_free_frame_buf

In MVC:mxc_free_frames

====================================================================================

 

It seems like the DMA buffer is empty.

Can you help me resolve this issue?

 

Thank you in advance.

 

(My base BSP version is L3.0.35_4.1.0 and kernel version is 3.0.35)

Outcomes