AnsweredAssumed Answered

ADV7181C connected to 16bit CSI

Question asked by kamel B on Jan 26, 2015
Latest reply on Mar 7, 2016 by Gang Li

Hi,

 

We are working with ADV7181C to get video from SVGA PC output (800x600@60Hz). The CSI is connected through :

 

CSIx_DAT4 ~ CSIx_DAT9

CSIx_DAT12 ~ CSIx_DAT19

 

We have set ADV7181C register's properly to output 16-bit YUV 4:2:2 as follow :

 

Then we applied patch from https://community.freescale.com/docs/DOC-97981.

 

But when we try to get frames with the following command :

~# ./mxc_v4l2_capture_sgrbg8 -ow 800 -oh 600 -c 500 -fr 25 testsgrbg8.bin

in_width = 176, in_height = 144

out_width = 800, out_height = 600

top = 0, left = 0

sensor chip is adv7180_decoder

sensor supported frame size:

720x576

     Width = 800     Height = 600     Image size = 960000

pixelformat: GRBG

VIDIOC_DQBUF failed.

VIDIOC_QBUF failed

We get timeout error (complete log) :

Jan 16 17:07:35 imx6q user.debug kernel: In MVC: mxc_v4l_open

Jan 16 17:07:35 imx6q user.debug kernel:    device name is Mxc Camera

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: adv7180:ioctl_g_ifparm

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: adv7180:ioctl_g_fmt_cap

Jan 16 17:07:35 imx6q user.debug kernel:    Returning size of 720x625

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l_open: v2f pix widthxheight 800 x 600

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l_open: crop_bounds widthxheight 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l_open: crop_defrect widthxheight 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l_open: crop_current widthxheight 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: On Open: Input to ipu size is 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: In adv7180:ioctl_init

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: adv7180:ioctl_dev_init

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_DBG_G_CHIP_IDENT chip_ident=7180, revision=0x0

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_ENUM_FRAMESIZES index=0, pixelformat=@��*, type=0 Mxc Camera: - Unknown type!

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_ENUM_FRAMESIZES index=1, pixelformat=@�ﴴ*, type=0 Mxc Camera: - Unknown type!

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_ENUM_FRAMESIZES error -22

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_ENUM_FMT error -22

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_S_PARM type=1

Jan 16 17:07:35 imx6q user.debug kernel: In mxc_v4l2_s_param

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: In adv7180:ioctl_g_parm

Jan 16 17:07:35 imx6q user.debug kernel:    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

Jan 16 17:07:35 imx6q user.debug kernel:    Current capabilities are 0

Jan 16 17:07:35 imx6q user.debug kernel:    Current capturemode is 0  change to 0

Jan 16 17:07:35 imx6q user.debug kernel:    Current framerate is 30  change to 25

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: In adv7180:ioctl_s_parm

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: adv7180:ioctl_g_ifparm

Jan 16 17:07:35 imx6q user.debug kernel:    clock_curr=mclk=27000000

Jan 16 17:07:35 imx6q user.debug kernel: adv7180 2-0021: adv7180:ioctl_g_fmt_cap

Jan 16 17:07:35 imx6q user.debug kernel:    Returning size of 720x625

Jan 16 17:07:35 imx6q user.debug kernel:    g_fmt_cap returns widthxheight of input as 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel:       csi params :

Jan 16 17:07:35 imx6q user.debug kernel: clock_mode 0x0

Jan 16 17:07:35 imx6q user.debug kernel: fmt 0x47425247

Jan 16 17:07:35 imx6q user.debug kernel: width 0x9

Jan 16 17:07:35 imx6q user.debug kernel: ext_vsync 0x1

Jan 16 17:07:35 imx6q user.debug kernel: vsync_pol 0x0

Jan 16 17:07:35 imx6q user.debug kernel: hsync_pol 0x0

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_S_INPUT value=0

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_G_CROP type=vid-cap

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: Rect start at 0x0, size=720x625

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_S_CROP type=vid-cap

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: Rect start at 0x0, size=176x144

Jan 16 17:07:35 imx6q user.debug kernel:    Cropping Input to ipu size 176 x 144

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_S_FMT type=vid-cap

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: width=800, height=600, format=GRBG, field=unknown, bytesperline=800 sizeimage=0, colorspace=2132

Jan 16 17:07:35 imx6q user.debug kernel: In MVC: mxc_v4l2_s_fmt

Jan 16 17:07:35 imx6q user.debug kernel:    type=V4L2_BUF_TYPE_VIDEO_CAPTURE

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_s_fmt: v2f pix widthxheight 800 x 600

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_s_fmt: crop_bounds widthxheight 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_s_fmt: crop_defrect widthxheight 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_s_fmt: crop_current widthxheight 176 x 144

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_S_CTRL id=0x8000000, value=0

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_v4l2_s_ctrl

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_streamoff

Jan 16 17:07:35 imx6q user.debug kernel: MVC: In mxc_free_frame_buf

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_allocate_frame_buf - size=960000

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_REQBUFS count=3, type=vid-cap, memory=mmap

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_G_FMT type=vid-cap

Jan 16 17:07:35 imx6q user.debug kernel: In MVC: mxc_v4l2_g_fmt type=1

Jan 16 17:07:35 imx6q user.debug kernel:    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_g_fmt: v2f pix widthxheight 800 x 600

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_g_fmt: crop_bounds widthxheight 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_g_fmt: crop_defrect widthxheight 720 x 625

Jan 16 17:07:35 imx6q user.debug kernel: End of mxc_v4l2_g_fmt: crop_current widthxheight 176 x 144

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: width=800, height=600, format=GRBG, field=unknown, bytesperline=1600 sizeimage=960000, colorspa2

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_v4l2_buffer_status

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_QUERYBUF 00:00:00.00000000 index=0, type=vid-cap, flags=0x00000001, field=0, sequence=0,p

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: bytesused=0, offset/userptr=0x18800000, length=962560

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_mmap

Jan 16 17:07:35 imx6q user.debug kernel:    pgoff=0x18800, start=0x2ad7d000, end=0x2ae68000

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_v4l2_buffer_status

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_QUERYBUF 00:00:00.00000000 index=1, type=vid-cap, flags=0x00000001, field=0, sequence=0,p

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: bytesused=0, offset/userptr=0x18b00000, length=962560

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_mmap

Jan 16 17:07:35 imx6q user.debug kernel:    pgoff=0x18b00, start=0x2aeb9000, end=0x2afa4000

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_v4l2_buffer_status

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_QUERYBUF 00:00:00.00000000 index=2, type=vid-cap, flags=0x00000001, field=0, sequence=0,p

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: bytesused=0, offset/userptr=0x18c00000, length=962560

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_mmap

Jan 16 17:07:35 imx6q user.debug kernel:    pgoff=0x18c00, start=0x2b097000, end=0x2b182000

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_QBUF 00:00:00.00000000 index=0, type=vid-cap, flags=0x00000003, field=0, sequence=0, memp

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: bytesused=0, offset/userptr=0x18800000, length=0

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_QBUF 00:00:00.00000000 index=1, type=vid-cap, flags=0x00000003, field=0, sequence=0, memp

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: bytesused=0, offset/userptr=0x18b00000, length=0

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_QBUF 00:00:00.00000000 index=2, type=vid-cap, flags=0x00000003, field=0, sequence=0, memp

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: bytesused=0, offset/userptr=0x18c00000, length=0

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000

Jan 16 17:07:35 imx6q user.debug kernel: Mxc Camera: VIDIOC_STREAMON type=vid-cap

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_streamon

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: init channel = 15

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: initializing idma ch 0 @ c08c0000

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: ch 0 word 0 - 00000000 00000000 00000000 E0001800 00095C63

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: ch 0 word 1 - 031A0000 00634000 00C1C000 00018FC0 00000000

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: PFS 0x6,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: BPP 0x3,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: NPB 0x7

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: FW 799,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: FH 599,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: EBA0 0x18d00000

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: EBA1 0x18d00000

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Stride 1599

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: scan_order 0

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: uv_stride 0

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: u_offset 0x0

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: v_offset 0x0

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Width0 0+1,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Width1 0+1,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Width2 0+1,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Width3 0+1,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Offset0 0,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Offset1 0,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Offset2 0,

Jan 16 17:07:35 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: Offset3 0

Jan 16 17:07:35 imx6q user.debug kernel: In MVC:mxc_v4l_dqueue

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

Jan 16 17:07:45 imx6q user.err kernel: ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

Jan 16 17:07:45 imx6q user.debug kernel: Mxc Camera: VIDIOC_DQBUF error -62

Jan 16 17:07:45 imx6q user.err kernel: ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

Jan 16 17:07:45 imx6q user.debug kernel: Mxc Camera: VIDIOC_QBUF error -22

Jan 16 17:07:45 imx6q user.debug kernel: Mxc Camera: VIDIOC_STREAMOFF type=vid-cap

Jan 16 17:07:45 imx6q user.debug kernel: In MVC:mxc_streamoff

Jan 16 17:07:45 imx6q user.debug kernel: imx-ipuv3 imx-ipuv3.0: CSI stop timeout - 5 * 10ms

Jan 16 17:07:45 imx6q user.debug kernel: In MVC:mxc_free_frames

Jan 16 17:07:45 imx6q user.debug kernel: In MVC:mxc_v4l_close

Jan 16 17:07:45 imx6q user.debug kernel: In MVC:mxc_streamoff

Jan 16 17:07:45 imx6q user.debug kernel: mxc_v4l_close: release resource

Jan 16 17:07:45 imx6q user.debug kernel: MVC: In mxc_free_frame_buf

Jan 16 17:07:45 imx6q user.debug kernel: In MVC:mxc_free_frames

 

Here is setting from adv7180.c  ioctl_g_ifparm() :

 

   /* Initialize structure to 0s then set any non-0 values. */
   memset(p, 0, sizeof(*p));
   p->if_type = V4L2_IF_TYPE_BT656; /* This is the only possibility. */
   p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT;
   p->u.bt656.bt_sync_correct = 1;
   //p->u.bt656.nobt_hs_inv = 1;
   //p->u.bt656.nobt_vs_inv = 1;
   p->u.bt656.clock_curr = 27000000;  //Gated clock mode
   /* ADV7180 has a dedicated clock so no clock settings needed. */

 

 

Outcomes