imx6 MIPI CSI with OV5648 camera

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

imx6 MIPI CSI with OV5648 camera

Jump to solution
19,808 Views
chrisroed
Contributor IV

Hello,  There seems to be lots of issues using Bayer Sensors on Freescale hardware.  I'm having some issues I'm hoping someone can help with.  I've reviewed in detail the following posts and have come up limited success

i.MX6 OV5647 Bayer sensor driver (ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0)

Some Experience When Enable MIPI Camera

Hardware:  custom imx6 based on wandboard

Kernel:      3.14.28_wandboard

Camera:  OV5648 (MIPI CSI 2  bayer sensor.  Output is set to 1280x720 8 bit)

Steps taken so far:

-Added ov5648 to device tree csi0, ipu0, lanes=2, virtual channel=0

-Modifided OV5640_mipi driver to work with OV5648

     set the pixel format to IPU_PIX_FMT_GENERIC (tried V4L2 formats, but nothing seemed to work)

     driver probe works, i2c works, camera is found, camera sends clock, data, and vsync

   

-Modified mxc_mipi_cs2.c

     in mipi_cs2_reset

          --> changed PHY1 to value 0x00000006 or 0x0000000c     

     this fixed a framing error in MIPI_ERR_1 regsiter

-Modified mxc_v4l2_capture.c

     in mxc_v4l2_open

          --> changed csi_param.ext_vsync = 1;

-Added debug flags to ipu and mipi Makefiles

from a terminal, running

$gst-launch-1.0 --gst-debug=*:2   imxv4l2videosrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! imxipuvideosink

produced an image on my display, however instead of one image, there was a 4x4 grid of smaller images that were clearly color corrupted, and were scrolling slowing down the screen (some sort of vsync issue?   See the attached image!)

I modified kernel code to accept V4L2_PIX_FMT_GREY and V4L2_PIX_FMT_SBGGR ( see this --> i.MX6 OV5647 Bayer sensor driver (ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0) )  and added a bunch of pr_debug messages

and now I'm stuck back at a timeout in the dqueue

console output from gst-launch command

Setting pipeline to PAUSED ...

ov5648 ioctl_dev_init ran

ERROR: unrecognized std! 0 (PAL=ff, NTSC=b000

Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

0:00:01.069024334   322  0x1e97c00 WARN                GST_PADS gstpad.c:3989:gst_pad_peer_query:<imxv4l2videosrc0:src> could not send sticky ev

ents

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

0:00:11.095804668   322  0x1e97c00 ERROR      imxv4l2bufferpool v4l2_buffer_pool.c:247:gst_imx_v4l2_buffer_pool_acquire_buffer:<imxv4l2bufferpoo

l0> VIDIOC_DQBUF failed: Timer expired

0:00:11.096162335   322  0x1e97c00 WARN                 basesrc gstbasesrc.c:2943:gst_base_src_loop:<imxv4l2videosrc0> error: Internal data flow

error.

0:00:11.096324001   322  0x1e97c00 WARN                 basesrc gstbasesrc.c:2943:gst_base_src_loop:<imxv4l2videosrc0> error: streaming task pau

sed, reason error (-5)

ERROR: from element /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0: Internal data flow error.

Additional debug info:

gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0:

streaming task paused, reason error (-5)

Execution ended after 0:00:10.033409667

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

dmesg from the gst-launch command

[   36.106852]

               In MVC: mxc_v4l_open

[   36.106870]    device name is Mxc Camera

[   36.106886] ioctl_g_ifparm: ENTER

[   36.106895] ioctl_g_ifparm: MIDDLE

[   36.106909]    clock_curr=mclk=24000000

[   36.106917] ioctl_g_ifparm: EXIT

[   36.106930] End of mxc_v4l_open: v2f pix widthxheight 1280 x 720

[   36.106942] End of mxc_v4l_open: crop_bounds widthxheight 1280 x 720

[   36.106953] End of mxc_v4l_open: crop_defrect widthxheight 1280 x 720

[   36.106964] End of mxc_v4l_open: crop_current widthxheight 1280 x 720

[   36.106973] On Open: Input to ipu size is 1280 x 720

[   36.106991] csi_init_interface: CSI using DATA_FMT_BAYER

[   36.107022] imx-ipuv3 2400000.ipu: CSI_SENS_CONF = 0x00008B00

[   36.107039] imx-ipuv3 2400000.ipu: CSI_ACT_FRM_SIZE = 0x02CF04FF

[   36.124058]    Setting mclk to 24 MHz

[   36.124073]  fps = 30

[   36.124120] mipi csi2 already enabled!

[   36.124129] running ov5648_init_mode

[   36.124136] ----------------------

[   36.124146] - start of ov5648_init_mode -

[   36.124154] ----------------------

[   36.124175] 0x3130302A => 0xFFFFFFFF & [0x021DC000] //

[   36.124197] 0x00000001 => 0xFFFFFFFF & [0x021DC004] //

[   36.124219] 0x00000001 => 0xFFFFFFFF & [0x021DC008] //

[   36.124238] 0x00000001 => 0xFFFFFFFF & [0x021DC00C] //

[   36.124257] 0x00000001 => 0xFFFFFFFF & [0x021DC010] //

[   36.124279] 0x00000300 => 0xFFFFFFFF & [0x021DC014] //

[   36.124297] 0x00000000 => 0xFFFFFFFF & [0x021DC018] //

[   36.124317] 0x00000000 => 0xFFFFFFFF & [0x021DC01C] //

[   36.124335] 0x00000000 => 0xFFFFFFFF & [0x021DC020] //

[   36.124356] 0x00000000 => 0xFFFFFFFF & [0x021DC024] //

[   36.124375] 0x00000000 => 0xFFFFFFFF & [0x021DC028] //

[   36.124393] 0x00000000 => 0xFFFFFFFF & [0x021DC02C] //

[   36.124414] 0x00000000 => 0xFFFFFFFF & [0x021DC030] //

[   36.124424] ----------------------

[   36.124434] CSI2 reset

[   36.124450] ----------------------

[   36.124467] 0x3130302A => 0xFFFFFFFF & [0x021DC000] //

[   36.124487] 0x00000001 => 0xFFFFFFFF & [0x021DC004] //

[   36.124506] 0x00000001 => 0xFFFFFFFF & [0x021DC008] //

[   36.124525] 0x00000001 => 0xFFFFFFFF & [0x021DC00C] //

[   36.124545] 0x00000001 => 0xFFFFFFFF & [0x021DC010] //

[   36.124564] 0x00000200 => 0xFFFFFFFF & [0x021DC014] //

[   36.124585] 0x00000000 => 0xFFFFFFFF & [0x021DC018] //

[   36.124604] 0x00000000 => 0xFFFFFFFF & [0x021DC01C] //

[   36.124625] 0x00000000 => 0xFFFFFFFF & [0x021DC020] //

[   36.124643] 0x00000000 => 0xFFFFFFFF & [0x021DC024] //

[   36.124663] 0x00000000 => 0xFFFFFFFF & [0x021DC028] //

[   36.124681] 0x00000000 => 0xFFFFFFFF & [0x021DC02C] //

[   36.124701] 0x00000000 => 0xFFFFFFFF & [0x021DC030] //

[   36.124711] ----------------------

[   36.124721] ov5648_init_mode found V4L2_PIX_FMT_GREY

[   36.814055] 0x3130302A => 0xFFFFFFFF & [0x021DC000] //

[   36.814086] 0x00000001 => 0xFFFFFFFF & [0x021DC004] //

[   36.814109] 0x00000001 => 0xFFFFFFFF & [0x021DC008] //

[   36.814129] 0x00000001 => 0xFFFFFFFF & [0x021DC00C] //

[   36.814149] 0x00000001 => 0xFFFFFFFF & [0x021DC010] //

[   36.814169] 0x00000300 => 0xFFFFFFFF & [0x021DC014] //

[   36.814190] 0x00000000 => 0xFFFFFFFF & [0x021DC018] //

[   36.814211] 0x00000000 => 0xFFFFFFFF & [0x021DC01C] //

[   36.814231] 0x00000000 => 0xFFFFFFFF & [0x021DC020] //

[   36.814250] 0x00000000 => 0xFFFFFFFF & [0x021DC024] //

[   36.814270] 0x00000000 => 0xFFFFFFFF & [0x021DC028] //

[   36.814290] 0x00000000 => 0xFFFFFFFF & [0x021DC02C] //

[   36.814309] 0x00000000 => 0xFFFFFFFF & [0x021DC030] //

[   36.814683] OV5648_stream_on: status = 0x00000300

[   36.814698] OV5648_stream_on: error1 = 0x00000000

[   36.814710] OV5648_stream_on: error2 = 0x00000000

[   36.814723] power: 0

[   36.814732] reset: 0

[   36.814747] 0x00000000 => 0x00180000 & [0x020E0004] // GPR1

[   36.814760] 0x00000000 => 0x00000007 & [0x020E0034] // GPR13

[   36.814783] 0x00000001 => 0x00000001 & [0x021DC004] // MIPI_CSI_N_LANES

[   36.814807] 0x00000000 => 0x0000000F & [0x021DC018] // MIPI_CSI_DATA_IDS_1

[   36.814828] 0x10000661 => 0xFFFFFFFF & [0x02600000] // IPU_CONF

[   36.814850] 0x80000000 => 0xFFFFFFFF & [0x0260003C] // IPU_INT_CTRL_1

[   36.814870] 0x00080000 => 0xFFFFFFFF & [0x02600040] // IPU_INT_CTRL_2

[   36.814890] 0x00800000 => 0xFFFFFFFF & [0x02608004] // IPU_IDMAC_CH_EN_1

[   36.814909] 0x00000000 => 0xFFFFFFFF & [0x02608008] // IPU_IDMAC_CH_EN_2

[   36.814928] 0x00000000 => 0xFFFFFFFF & [0x02600078] // IPU_SDMA_EVENT_1

[   36.814947] 0x00000000 => 0xFFFFFFFF & [0x0260007C] // IPU_SDMA_EVENT_2

[   36.814968] 0x00800000 => 0xFFFFFFFF & [0x02600200] // IPU0_INT_STAT_1

[   36.814987] 0x00000000 => 0xFFFFFFFF & [0x02600204] // IPU0_INT_STAT_2

[   36.815005] 0xC0000000 => 0xFFFFFFFF & [0x02620000] // IPU_IC_CONF

[   36.815032] 0x04000B20 => 0xFFFFFFFF & [0x02630000] // IPU_CSI0_SENS_CONF

[   36.815053] 0x00000000 => 0xFFFFFFFF & [0x02638000] // IPU_CSI1_SENS_CONF

[   36.815072] 0xFFFFFFFF => 0xFFFFFFFF & [0x02630020] // IPUx_CSI0_DI

[   36.815091] 0x00000000 => 0xFFFFFFFF & [0x02638000] // PUx_CSI0_SENS_CONF

[   36.815118] 0x00000000 => 0xFFFFFFFF & [0x02638004] // IPUx_CSI0_SENS_FRM_SIZE

[   36.815140] 0x00000000 => 0xFFFFFFFF & [0x02638008] // IPUx_CSI0_ACT_FRM_SIZE

[   36.815164] 0x00000300 => 0xFFFFFFFF & [0x021DC014] // MIPI_CSI_PHY_STATE

[   36.815185] 0x00000000 => 0xFFFFFFFF & [0x021DC020] // MIPI_CSI_ERR1

[   36.815205] 0x00000000 => 0xFFFFFFFF & [0x021DC024] // MIPI_CSI_ERR2

[   36.815239] 0x00000000 => 0xFFFFFFFF & [0x021DC020] // MIPI_CSI_ERR1

[   36.815260] 0x00000000 => 0xFFFFFFFF & [0x021DC024] // MIPI_CSI_ERR2

[   36.815272] ov5648 ioctl_dev_init ran

[   36.817700] In MVC:mxc_v4l_ioctl

[   36.817714] In MVC: mxc_v4l_do_ioctl 80085617

[   36.817723]    case VIDIOC_G_STD

[   36.817731] In mxc_v4l2_g_std

[   36.817743] In MVC:mxc_v4l_ioctl

[   36.817754] In MVC: mxc_v4l_do_ioctl 40085618

[   36.817762]    case VIDIOC_S_STD

[   36.817770] In mxc_v4l2_s_std 0

[   36.817782] ERROR: unrecognized std! 0 (PAL=ff, NTSC=b000

[   36.821891] In MVC:mxc_v4l_ioctl

[   36.821906] In MVC: mxc_v4l_do_ioctl c0cc5604

[   36.821915]    case VIDIOC_G_FMT

[   36.821923] In MVC: mxc_v4l2_g_fmt type=1

[   36.821932]    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

[   36.821945] End of mxc_v4l2_g_fmt: v2f pix widthxheight 1280 x 720

[   36.821956] End of mxc_v4l2_g_fmt: crop_bounds widthxheight 720 x 625

[   36.821967] End of mxc_v4l2_g_fmt: crop_defrect widthxheight 1280 x 720

[   36.821978] End of mxc_v4l2_g_fmt: crop_current widthxheight 720 x 576

[   36.821990] In MVC:mxc_v4l_ioctl

[   36.822000] In MVC: mxc_v4l_do_ioctl c02c564a

[   36.822013] In MVC:mxc_v4l_ioctl

[   36.822022] In MVC: mxc_v4l_do_ioctl c0045627

[   36.822031]    case VIDIOC_S_INPUT

[   36.822040] In MVC:mxc_streamoff

[   36.822050] In MVC:mxc_v4l_ioctl

[   36.822060] In MVC: mxc_v4l_do_ioctl c0cc5616

[   36.822068]    case VIDIOC_S_PARM

[   36.822077] In mxc_v4l2_s_param

[   36.822087]    Current capabilities are 1001

[   36.822097]    Current capturemode is 0  change to 0

[   36.822106]    Current framerate is 30  change to 30

[   36.834353] ioctl_s_parm

[   36.834362] power: 0

[   36.834369] reset: 0

[   36.834379] 0x00000000 => 0x00180000 & [0x020E0004] // GPR1

[   36.834387] 0x00000000 => 0x00000007 & [0x020E0034] // GPR13

[   36.834402] 0x00000001 => 0x00000001 & [0x021DC004] // MIPI_CSI_N_LANES

[   36.834420] 0x00000000 => 0x0000000F & [0x021DC018] // MIPI_CSI_DATA_IDS_1

[   36.834432] 0x10000661 => 0xFFFFFFFF & [0x02600000] // IPU_CONF

[   36.834444] 0x80000000 => 0xFFFFFFFF & [0x0260003C] // IPU_INT_CTRL_1

[   36.834457] 0x00080000 => 0xFFFFFFFF & [0x02600040] // IPU_INT_CTRL_2

[   36.834470] 0x00800000 => 0xFFFFFFFF & [0x02608004] // IPU_IDMAC_CH_EN_1

[   36.834482] 0x00000000 => 0xFFFFFFFF & [0x02608008] // IPU_IDMAC_CH_EN_2

[   36.834495] 0x00000000 => 0xFFFFFFFF & [0x02600078] // IPU_SDMA_EVENT_1

[   36.834505] 0x00000000 => 0xFFFFFFFF & [0x0260007C] // IPU_SDMA_EVENT_2

[   36.834516] 0x00800000 => 0xFFFFFFFF & [0x02600200] // IPU0_INT_STAT_1

[   36.834526] 0x00000000 => 0xFFFFFFFF & [0x02600204] // IPU0_INT_STAT_2

[   36.834538] 0xC0000000 => 0xFFFFFFFF & [0x02620000] // IPU_IC_CONF

[   36.834554] 0x04000B20 => 0xFFFFFFFF & [0x02630000] // IPU_CSI0_SENS_CONF

[   36.834565] 0x00000000 => 0xFFFFFFFF & [0x02638000] // IPU_CSI1_SENS_CONF

[   36.834577] 0xFFFFFFFF => 0xFFFFFFFF & [0x02630020] // IPUx_CSI0_DI

[   36.834588] 0x00000000 => 0xFFFFFFFF & [0x02638000] // PUx_CSI0_SENS_CONF

[   36.834602] 0x00000000 => 0xFFFFFFFF & [0x02638004] // IPUx_CSI0_SENS_FRM_SIZE

[   36.834615] 0x00000000 => 0xFFFFFFFF & [0x02638008] // IPUx_CSI0_ACT_FRM_SIZE

[   36.834625] 0x00000300 => 0xFFFFFFFF & [0x021DC014] // MIPI_CSI_PHY_STATE

[   36.834635] 0x00000000 => 0xFFFFFFFF & [0x021DC020] // MIPI_CSI_ERR1

[   36.834645] 0x00000000 => 0xFFFFFFFF & [0x021DC024] // MIPI_CSI_ERR2

[   36.834662] 0x00000000 => 0xFFFFFFFF & [0x021DC020] // MIPI_CSI_ERR1

[   36.834672] 0x00000000 => 0xFFFFFFFF & [0x021DC024] // MIPI_CSI_ERR2

[   36.834681] ioctl_g_ifparm: ENTER

[   36.834685] ioctl_g_ifparm: MIDDLE

[   36.834690]    clock_curr=mclk=24000000

[   36.834694] ioctl_g_ifparm: EXIT

[   36.834700]    clock_curr=mclk=24000000

[   36.834704] mxc_v4ls_s_param: csi clock mode set to gated clk

[   36.834710]    g_fmt_cap returns widthxheight of input as 1280 x 720

[   36.834720] csi_init_interface: CSI using DATA_FMT_BAYER

[   36.834736] imx-ipuv3 2400000.ipu: CSI_SENS_CONF = 0x00000B00

[   36.834744] imx-ipuv3 2400000.ipu: CSI_ACT_FRM_SIZE = 0x02CF04FF

[   36.834757] In MVC:mxc_v4l_ioctl

[   36.834765] In MVC: mxc_v4l_do_ioctl c0cc5605

[   36.834769]    case VIDIOC_S_FMT

[   36.834773] In MVC: mxc_v4l2_s_fmt

[   36.834778]    type=V4L2_BUF_TYPE_VIDEO_CAPTURE

[   36.834784] mxc_v4l2_s_fmt: Setting format to V4L2_PIX_FMT_GREY

[   36.834790] mxc_v4ls_s_fmt:  size: 921600

                bytesperline is 1280

[   36.834796] End of mxc_v4l2_s_fmt: v2f pix widthxheight 1280 x 720

[   36.834802] End of mxc_v4l2_s_fmt: crop_bounds widthxheight 1280 x 720

[   36.834807] End of mxc_v4l2_s_fmt: crop_defrect widthxheight 1280 x 720

[   36.834813] End of mxc_v4l2_s_fmt: crop_current widthxheight 1280 x 720

[   36.834927] In MVC:mxc_v4l_ioctl

[   36.834938] In MVC: mxc_v4l_do_ioctl c0cc5604

[   36.834942]    case VIDIOC_G_FMT

[   36.834946] In MVC: mxc_v4l2_g_fmt type=1

[   36.834950]    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

[   36.834956] End of mxc_v4l2_g_fmt: v2f pix widthxheight 1280 x 720

[   36.834962] End of mxc_v4l2_g_fmt: crop_bounds widthxheight 1280 x 720

[   36.834967] End of mxc_v4l2_g_fmt: crop_defrect widthxheight 1280 x 720

[   36.834973] End of mxc_v4l2_g_fmt: crop_current widthxheight 1280 x 720

[   36.845173] In MVC:mxc_v4l_ioctl

[   36.845189] In MVC: mxc_v4l_do_ioctl c0cc5604

[   36.845195]    case VIDIOC_G_FMT

[   36.845199] In MVC: mxc_v4l2_g_fmt type=1

[   36.845203]    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

[   36.845210] End of mxc_v4l2_g_fmt: v2f pix widthxheight 1280 x 720

[   36.845217] End of mxc_v4l2_g_fmt: crop_bounds widthxheight 1280 x 720

[   36.845223] End of mxc_v4l2_g_fmt: crop_defrect widthxheight 1280 x 720

[   36.845228] End of mxc_v4l2_g_fmt: crop_current widthxheight 1280 x 720

[   36.845891] In MVC:mxc_v4l_ioctl

[   36.845902] In MVC: mxc_v4l_do_ioctl c0cc5604

[   36.845908]    case VIDIOC_G_FMT

[   36.845913] In MVC: mxc_v4l2_g_fmt type=1

[   36.845916]    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

[   36.845923] End of mxc_v4l2_g_fmt: v2f pix widthxheight 1280 x 720

[   36.845929] End of mxc_v4l2_g_fmt: crop_bounds widthxheight 1280 x 720

[   36.845935] End of mxc_v4l2_g_fmt: crop_defrect widthxheight 1280 x 720

[   36.845940] End of mxc_v4l2_g_fmt: crop_current widthxheight 1280 x 720

[   36.846411] In MVC:mxc_v4l_ioctl

[   36.846421] In MVC: mxc_v4l_do_ioctl c0145608

[   36.846425]    case VIDIOC_REQBUFS

[   36.846429] In MVC:mxc_streamoff

[   36.846434] MVC: In mxc_free_frame_buf

[   36.846441] In MVC:mxc_allocate_frame_buf - size=921600

[   36.867533] In MVC:mxc_v4l_ioctl

[   36.867546] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867551]    case VIDIOC_QUERYBUF

[   36.867555] In MVC:mxc_v4l2_buffer_status

[   36.867574] In MVC:mxc_mmap

[   36.867579]    pgoff=0x24400, start=0x7561f000, end=0x75700000

[   36.867604] In MVC:mxc_v4l_ioctl

[   36.867608] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867611]    case VIDIOC_QUERYBUF

[   36.867615] In MVC:mxc_v4l2_buffer_status

[   36.867627] In MVC:mxc_v4l_ioctl

[   36.867633] In MVC: mxc_v4l_do_ioctl c044560f

[   36.867637]    case VIDIOC_QBUF

[   36.867643] In MVC:mxc_v4l_ioctl

[   36.867649] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867652]    case VIDIOC_QUERYBUF

[   36.867655] In MVC:mxc_v4l2_buffer_status

[   36.867663] In MVC:mxc_mmap

[   36.867668]    pgoff=0x24500, start=0x7541f000, end=0x75500000

[   36.867690] In MVC:mxc_v4l_ioctl

[   36.867694] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867697]    case VIDIOC_QUERYBUF

[   36.867700] In MVC:mxc_v4l2_buffer_status

[   36.867707] In MVC:mxc_v4l_ioctl

[   36.867711] In MVC: mxc_v4l_do_ioctl c044560f

[   36.867715]    case VIDIOC_QBUF

[   36.867720] In MVC:mxc_v4l_ioctl

[   36.867724] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867727]    case VIDIOC_QUERYBUF

[   36.867730] In MVC:mxc_v4l2_buffer_status

[   36.867739] In MVC:mxc_mmap

[   36.867744]    pgoff=0x24600, start=0x7533e000, end=0x7541f000

[   36.867777] In MVC:mxc_v4l_ioctl

[   36.867783] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867786]    case VIDIOC_QUERYBUF

[   36.867789] In MVC:mxc_v4l2_buffer_status

[   36.867796] In MVC:mxc_v4l_ioctl

[   36.867800] In MVC: mxc_v4l_do_ioctl c044560f

[   36.867804]    case VIDIOC_QBUF

[   36.867810] In MVC:mxc_v4l_ioctl

[   36.867814] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867817]    case VIDIOC_QUERYBUF

[   36.867820] In MVC:mxc_v4l2_buffer_status

[   36.867828] In MVC:mxc_mmap

[   36.867833]    pgoff=0x24700, start=0x7525d000, end=0x7533e000

[   36.867855] In MVC:mxc_v4l_ioctl

[   36.867859] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867862]    case VIDIOC_QUERYBUF

[   36.867865] In MVC:mxc_v4l2_buffer_status

[   36.867872] In MVC:mxc_v4l_ioctl

[   36.867876] In MVC: mxc_v4l_do_ioctl c044560f

[   36.867879]    case VIDIOC_QBUF

[   36.867885] In MVC:mxc_v4l_ioctl

[   36.867889] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867892]    case VIDIOC_QUERYBUF

[   36.867895] In MVC:mxc_v4l2_buffer_status

[   36.867902] In MVC:mxc_mmap

[   36.867907]    pgoff=0x24800, start=0x7517c000, end=0x7525d000

[   36.867935] In MVC:mxc_v4l_ioctl

[   36.867939] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867943]    case VIDIOC_QUERYBUF

[   36.867946] In MVC:mxc_v4l2_buffer_status

[   36.867953] In MVC:mxc_v4l_ioctl

[   36.867957] In MVC: mxc_v4l_do_ioctl c044560f

[   36.867960]    case VIDIOC_QBUF

[   36.867966] In MVC:mxc_v4l_ioctl

[   36.867970] In MVC: mxc_v4l_do_ioctl c0445609

[   36.867973]    case VIDIOC_QUERYBUF

[   36.867976] In MVC:mxc_v4l2_buffer_status

[   36.867983] In MVC:mxc_mmap

[   36.867988]    pgoff=0x24900, start=0x7509b000, end=0x7517c000

[   36.868009] In MVC:mxc_v4l_ioctl

[   36.868014] In MVC: mxc_v4l_do_ioctl c0445609

[   36.868017]    case VIDIOC_QUERYBUF

[   36.868020] In MVC:mxc_v4l2_buffer_status

[   36.868027] In MVC:mxc_v4l_ioctl

[   36.868030] In MVC: mxc_v4l_do_ioctl c044560f

[   36.868034]    case VIDIOC_QBUF

[   36.868039] In MVC:mxc_v4l_ioctl

[   36.868042] In MVC: mxc_v4l_do_ioctl 40045612

[   36.868046]    case VIDIOC_STREAMON

[   36.868049] In MVC:mxc_streamon

[   36.868053] mxc_streamon got through error check

[   36.868056] mxc_streamon got through cam_overlay check

[   36.868059] got through if cam->enc_enable check

[   36.868062] IPU:In csi_enc_enabling_tasks

[   36.873393] In csi_enc_setup with format 0x59455247

[   36.873402] csi_enc_setup: Setting IPU_PIX_FMT_GREY

[   36.873422] imx-ipuv3 2400000.ipu: init channel = 15

[   36.873431] ipu_init_channel: configuring SMFC for MIPI

[   36.873436] _ipu_csi_init: CSI data going to IDMAC

[   36.873440] IPU register dump after ipu_init_channel

[   36.873448] imx-ipuv3 2400000.ipu: IPU_CONF =        0x10000661

[   36.873454] imx-ipuv3 2400000.ipu: IDMAC_CONF =      0x0000002F

[   36.873461] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN1 =   0x00800000

[   36.873468] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN2 =   0x00000000

[   36.873475] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI1 =  0x18800001

[   36.873482] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI2 =  0x00000000

[   36.873488] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN1 =  0x00000000

[   36.873495] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN2 =  0x00000000

[   36.873501] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL0 =    0x00000000

[   36.873508] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL1 =    0x00000000

[   36.873515] imx-ipuv3 2400000.ipu: IPU_CHA_TRB_MODE_SEL0 =   0x00800000

[   36.873521] imx-ipuv3 2400000.ipu: IPU_CHA_TRB_MODE_SEL1 =   0x00000000

[   36.873528] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN =    0x00000090

[   36.873535] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN_DEF =        0x202020F6

[   36.873541] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN =    0x00009694

[   36.873548] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN_DEF =        0x2020F6F6

[   36.873555] imx-ipuv3 2400000.ipu: DMFC_IC_CTRL =    0x00000002

[   36.873561] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW1 =       0x00000000

[   36.873567] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW2 =       0x00000000

[   36.873574] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW3 =       0x00000000

[   36.873580] imx-ipuv3 2400000.ipu: IPU_FS_DISP_FLOW1 =       0x00000000

[   36.873587] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_FSIZE =      0x00000000

[   36.873595] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_C =  0x00000000

[   36.873601] imx-ipuv3 2400000.ipu: IPU_IC_CONF =     0xC0000000

[   36.873606] ipu_common: bytes_per_pixel set to 1

[   36.873610] _ipu_channel_param_init: Setting IDMAC channel parameters for IPU_PIX_FMT_GREY

[   36.873618] imx-ipuv3 2400000.ipu: initializing idma ch 0 @ a08c0000

[   36.873628] _ipu_channel_param_init: dumping ipu channel param info

[   36.873638] imx-ipuv3 2400000.ipu: ch 0 word 0 - 00000000 00000000 00000000 E0002800 000B3C9F

[   36.873646] imx-ipuv3 2400000.ipu: ch 0 word 1 - 04940000 00928000 00CFC000 00013FC0 00000000

[   36.873653] imx-ipuv3 2400000.ipu: PFS 0x6,

[   36.873660] imx-ipuv3 2400000.ipu: BPP 0x5,

[   36.873665] imx-ipuv3 2400000.ipu: NPB 0x3f

[   36.873671] imx-ipuv3 2400000.ipu: FW 1279,

[   36.873677] imx-ipuv3 2400000.ipu: FH 719,

[   36.873683] imx-ipuv3 2400000.ipu: EBA0 0x24a00000

[   36.873690] imx-ipuv3 2400000.ipu: EBA1 0x24a00000

[   36.873697] imx-ipuv3 2400000.ipu: Stride 1279

[   36.873703] imx-ipuv3 2400000.ipu: scan_order 0

[   36.873708] imx-ipuv3 2400000.ipu: uv_stride 0

[   36.873716] imx-ipuv3 2400000.ipu: u_offset 0x0

[   36.873722] imx-ipuv3 2400000.ipu: v_offset 0x0

[   36.873728] imx-ipuv3 2400000.ipu: Width0 0+1,

[   36.873734] imx-ipuv3 2400000.ipu: Width1 0+1,

[   36.873739] imx-ipuv3 2400000.ipu: Width2 0+1,

[   36.873745] imx-ipuv3 2400000.ipu: Width3 0+1,

[   36.873752] imx-ipuv3 2400000.ipu: Offset0 0,

[   36.873759] imx-ipuv3 2400000.ipu: Offset1 0,

[   36.873764] imx-ipuv3 2400000.ipu: Offset2 0,

[   36.873770] imx-ipuv3 2400000.ipu: Offset3 0

[   36.873776] ipu_init_channel_buffer: detected SMFC channel, burst size is 64 bits

[   36.873781] ipu_init_channel_buffer: burst size now set to 16

[   36.873792] imx-ipuv3 2400000.ipu: ch 0 word 0 - 00000000 00000000 00000000 E0002800 000B3C9F

[   36.873802] imx-ipuv3 2400000.ipu: ch 0 word 1 - 04940000 00928000 00CFC000 00013FC0 00000000

[   36.873808] imx-ipuv3 2400000.ipu: PFS 0x6,

[   36.873814] imx-ipuv3 2400000.ipu: BPP 0x5,

[   36.873821] imx-ipuv3 2400000.ipu: NPB 0x3f

[   36.873828] imx-ipuv3 2400000.ipu: FW 1279,

[   36.873833] imx-ipuv3 2400000.ipu: FH 719,

[   36.873841] imx-ipuv3 2400000.ipu: EBA0 0x24a00000

[   36.873847] imx-ipuv3 2400000.ipu: EBA1 0x24a00000

[   36.873853] imx-ipuv3 2400000.ipu: Stride 1279

[   36.873860] imx-ipuv3 2400000.ipu: scan_order 0

[   36.873865] imx-ipuv3 2400000.ipu: uv_stride 0

[   36.873871] imx-ipuv3 2400000.ipu: u_offset 0x0

[   36.873878] imx-ipuv3 2400000.ipu: v_offset 0x0

[   36.873884] imx-ipuv3 2400000.ipu: Width0 0+1,

[   36.873889] imx-ipuv3 2400000.ipu: Width1 0+1,

[   36.873895] imx-ipuv3 2400000.ipu: Width2 0+1,

[   36.873901] imx-ipuv3 2400000.ipu: Width3 0+1,

[   36.873907] imx-ipuv3 2400000.ipu: Offset0 0,

[   36.873913] imx-ipuv3 2400000.ipu: Offset1 0,

[   36.873919] imx-ipuv3 2400000.ipu: Offset2 0,

[   36.873926] imx-ipuv3 2400000.ipu: Offset3 0

[   36.873931] ipu_enable_channel: Enabling IPU channel

[   36.873937] mxc_streamon got through cam->enc_enable

[   36.874028] eba 24400000

[   36.874035] eba 24500000

[   36.874041] got to csi_enc_enable_csi

[   36.874044] In ipu_enable_csi

[   36.874049] ipu_enable_csi: Enabling CSI 0

[   36.874052] Dumping IPU registers from ipu_enable_csi:

[   36.874061] imx-ipuv3 2400000.ipu: IPU_CONF =        0x10000761

[   36.874068] imx-ipuv3 2400000.ipu: IDMAC_CONF =      0x0000002F

[   36.874075] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN1 =   0x00800001

[   36.874081] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN2 =   0x00000000

[   36.874087] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI1 =  0x18800001

[   36.874094] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI2 =  0x00000000

[   36.874101] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN1 =  0x00000000

[   36.874107] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN2 =  0x00000000

[   36.874114] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL0 =    0x00000001

[   36.874121] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL1 =    0x00000000

[   36.874128] imx-ipuv3 2400000.ipu: IPU_CHA_TRB_MODE_SEL0 =   0x00800000

[   36.874135] imx-ipuv3 2400000.ipu: IPU_CHA_TRB_MODE_SEL1 =   0x00000000

[   36.874141] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN =    0x00000090

[   36.874147] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN_DEF =        0x202020F6

[   36.874154] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN =    0x00009694

[   36.874162] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN_DEF =        0x2020F6F6

[   36.874168] imx-ipuv3 2400000.ipu: DMFC_IC_CTRL =    0x00000002

[   36.874174] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW1 =       0x00000000

[   36.874182] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW2 =       0x00000000

[   36.874188] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW3 =       0x00000000

[   36.874194] imx-ipuv3 2400000.ipu: IPU_FS_DISP_FLOW1 =       0x00000000

[   36.874202] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_FSIZE =      0x00000000

[   36.874209] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_C =  0x00000000

[   36.874216] imx-ipuv3 2400000.ipu: IPU_IC_CONF =     0xC0000000

[   36.874289] In MVC:mxc_v4l_ioctl

[   36.874298] In MVC: mxc_v4l_do_ioctl c0445611

[   36.874302]    case VIDIOC_DQBUF                              <===== CODE IS WAITING FOR FRAME TO ARRIVE

[   36.874305] In MVC:mxc_v4l_dqueue

[   46.874050] ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

[   46.882100] In MVC:mxc_v4l_ioctl

[   46.882124] In MVC: mxc_v4l_do_ioctl 40045613

[   46.882135]    case VIDIOC_STREAMOFF

[   46.882143] In MVC:mxc_streamoff

[   47.374039] imx-ipuv3 2400000.ipu: CSI stop timeout - 5 * 10ms

[   47.374449] In MVC:mxc_free_frames

[   47.375396] In MVC:mxc_v4l_close

[   47.394052] mxc_v4l_close: release resource

[   47.394067] MVC: In mxc_free_frame_buf

[   47.396226] In MVC:mxc_free_frames

[   47.397367] mxc_ipu mxc_ipu: free 4096 bytes @ 0x24300000

Labels (5)
1 Solution
5,234 Views
chrisroed
Contributor IV

To Recap...  There's the actions taken to get this working.

Modified Kernel to accept bayer pixels..  Make sure the MIPI clock is at the right speed

See original posts for links to fix these

Also, not sure why but I had to hardcode external vsync and the pixel format in parts of ipu setup.

Wrote driver for ov5648 based on ov5640_mipi.c

Contact the camera rep for register settings, be sure to look through the settings...  the ones I was given did not have the external vsync, auto white balance (hence the green color) or automatic gain/exposure controls enabled.

Modified gstreamer-imx

v4l2src.c  -->  hardcoded bayer pixel format sources. 

Download gst-plugins-bad for the bayer2rgb plugin

Ran gstreamer

$gst-launch-1.0 imxv4l2videosrc ! video/x-bayer,format=bggr,width=1280,height=720,framerate=30/1 ! bayer2rgb ! imxipuvideosink

Since the imx6 doesn't have bayer support this eats the entire CPU and I get a terrible framerate.  640x480 works alright.  I'm going to work on writing a bayer2rgb plugin that is optimized for this arm core, but I don't know how effective that will be. 

I got a much better framerate when I streamed the video over UDP

### imx stream to pc ###

gst-launch-1.0 -v imxv4l2videosrc ! \

  video/x-bayer,format=bggr,width=1280,height=720,framerate=30/1 ! \

  bayer2rgb ! imxipuvideotransform ! imxvpuenc_h264 ! rtph264pay ! \

  udpsink host=$DESTINATION_IP port=5000

### pc stream from imx  ###

gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! \

  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink

In short, don't use a bayer sensor with the imx6 if you don't have to.  Get an RGB or YUV camera.  You will be much happier.

View solution in original post

0 Kudos
15 Replies
5,235 Views
chrisroed
Contributor IV

To Recap...  There's the actions taken to get this working.

Modified Kernel to accept bayer pixels..  Make sure the MIPI clock is at the right speed

See original posts for links to fix these

Also, not sure why but I had to hardcode external vsync and the pixel format in parts of ipu setup.

Wrote driver for ov5648 based on ov5640_mipi.c

Contact the camera rep for register settings, be sure to look through the settings...  the ones I was given did not have the external vsync, auto white balance (hence the green color) or automatic gain/exposure controls enabled.

Modified gstreamer-imx

v4l2src.c  -->  hardcoded bayer pixel format sources. 

Download gst-plugins-bad for the bayer2rgb plugin

Ran gstreamer

$gst-launch-1.0 imxv4l2videosrc ! video/x-bayer,format=bggr,width=1280,height=720,framerate=30/1 ! bayer2rgb ! imxipuvideosink

Since the imx6 doesn't have bayer support this eats the entire CPU and I get a terrible framerate.  640x480 works alright.  I'm going to work on writing a bayer2rgb plugin that is optimized for this arm core, but I don't know how effective that will be. 

I got a much better framerate when I streamed the video over UDP

### imx stream to pc ###

gst-launch-1.0 -v imxv4l2videosrc ! \

  video/x-bayer,format=bggr,width=1280,height=720,framerate=30/1 ! \

  bayer2rgb ! imxipuvideotransform ! imxvpuenc_h264 ! rtph264pay ! \

  udpsink host=$DESTINATION_IP port=5000

### pc stream from imx  ###

gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! \

  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink

In short, don't use a bayer sensor with the imx6 if you don't have to.  Get an RGB or YUV camera.  You will be much happier.

0 Kudos
5,236 Views
guna007
Contributor III

Chris,

I am also trying out something similar getting bayer image from image sensor and use bayer2rgb using gstreamer. Can you explain where I need to hardcode the format information in v4l2src.c (gstreamer-imx)

0 Kudos
5,236 Views
DanJozwiak
Contributor II

Hi Chris:

Would you be willing to post your changes to v4l2src.c? I'm in a similar situation, having to interface a camera outputting Bayer format to the i.MX6. I have the kernel changes complete but I'm not familiar with GStreamer-related changes.

Thanks...

Dan

0 Kudos
5,236 Views
chrisroed
Contributor IV

Hi Dan,

We ended up scrapping the bayer image camera in favor of a YUV one, so I deleted the files a while ago while cleaning up.  We were never able to get an acceptable framerate at 720p for our project.  I can let you know what I remember though... (I'm also not a gstreamer expert, and somewhat new to linux so this is kind of a rough hack)

grep through the file and find the video/x-raw entries and change them to video/x-bayer.  If you have any other x-raw cameras, the won't work. 

I also hardcored V4L2_PIX_FMT_SBGGR8, I can't remember exactly where I did that, but if you grep for "I420" it should give you a good idea on where to start.  I'm sorry I can't be more helpful.

p.s.   we were told that it's possible to use gl shaderes to de-bayer the data, but freescale could only get 28fps on the imx6quad (4 shaders) and it was unrealistic for us to expect more than 10-15 fps at 720p with our solo processor.  Best of luck to you!

0 Kudos
5,236 Views
DanJozwiak
Contributor II

Hi Chris:

Thanks for the response.

I see...so you just replaced the x-raw (and subsequent parameters) with the x-bayer. I can do that. I was trying to add x-bayer as an additional format so that I could keep the original functionality and it was the add that I was trying to figure out how to do. But for the test I can just replace it as you did and that will at least allow me to verify the processing...thanks.

Yes, I can understand the limitations with this on the i.MX6. All this gets pushed to the CPU and ends up being a burden. Fortunately the video stream doesn't have very stringent requirements so even if the frame rates are slower it will allow us to proceed. Thanks very much for your help!

Dan

0 Kudos
5,236 Views
chrisroed
Contributor IV

I used Gstreamer to capture a jpeg of the output.  It's a little better than the picture I posted ealier

capture1.jpeg

0 Kudos
5,236 Views
jimmychan
NXP TechSupport
NXP TechSupport

For the 16 images issue , please try this patch.

0001-Correct-mipi-camera-virtual-channel-setting-in-ipu_c.patch

It is the updated IPU code for MIPI ID and SMFC setting in ipu_capture.c. These setting should not be combined with MIPI virtual channel value, they shoule be fixed with ID 0.

Sample code for iMX6 SabreSD to use MIPI CSI camera with virtual channel 3

From 28fe368ee7f87ecfdf9a8621f4a6114396ee8157 Mon Sep 17 00:00:00 2001

From: b19715 <b19715@freescale.com>

Date: Tue, 30 Sep 2014 11:48:11 +0800

Subject: [PATCH 1/2] Correct mipi camera virtual channel setting in

  ipu_capture.c.

---

drivers/mxc/ipu3/ipu_capture.c |   21 +++++++++++----------

1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/mxc/ipu3/ipu_capture.c b/drivers/mxc/ipu3/ipu_capture.c

index b1d6fb3..6a924c9 100644

--- a/drivers/mxc/ipu3/ipu_capture.c

+++ b/drivers/mxc/ipu3/ipu_capture.c

@@ -492,18 +492,18 @@ int _ipu_csi_set_mipi_di(struct ipu_soc *ipu, uint32_t num, uint32_t di_val, uin

         ipu_csi_write(ipu, csi, temp, CSI_MIPI_DI);

         break;

     case IPU_CSI_MIPI_DI1:

-        temp &= ~CSI_MIPI_DI1_MASK;

-        temp |= (di_val << CSI_MIPI_DI1_SHIFT);

+        temp &= ~CSI_MIPI_DI0_MASK;

+        temp |= (di_val << CSI_MIPI_DI0_SHIFT);

         ipu_csi_write(ipu, csi, temp, CSI_MIPI_DI);

         break;

     case IPU_CSI_MIPI_DI2:

-        temp &= ~CSI_MIPI_DI2_MASK;

-        temp |= (di_val << CSI_MIPI_DI2_SHIFT);

+        temp &= ~CSI_MIPI_DI0_MASK;

+        temp |= (di_val << CSI_MIPI_DI0_SHIFT);

         ipu_csi_write(ipu, csi, temp, CSI_MIPI_DI);

         break;

     case IPU_CSI_MIPI_DI3:

-        temp &= ~CSI_MIPI_DI3_MASK;

-        temp |= (di_val << CSI_MIPI_DI3_SHIFT);

+        temp &= ~CSI_MIPI_DI0_MASK;

+        temp |= (di_val << CSI_MIPI_DI0_SHIFT);

         ipu_csi_write(ipu, csi, temp, CSI_MIPI_DI);

         break;

     default:

@@ -594,25 +594,26 @@ err:

void _ipu_smfc_init(struct ipu_soc *ipu, ipu_channel_t channel, uint32_t mipi_id, uint32_t csi)

{

     uint32_t temp;

+    uint32_t id = 0;

     temp = ipu_smfc_read(ipu, SMFC_MAP);

     switch (channel) {

     case CSI_MEM0:

         temp &= ~SMFC_MAP_CH0_MASK;

-        temp |= ((csi << 2) | mipi_id) << SMFC_MAP_CH0_SHIFT;

+        temp |= ((csi << 2) | id) << SMFC_MAP_CH0_SHIFT;

         break;

     case CSI_MEM1:

         temp &= ~SMFC_MAP_CH1_MASK;

-        temp |= ((csi << 2) | mipi_id) << SMFC_MAP_CH1_SHIFT;

+        temp |= ((csi << 2) | id) << SMFC_MAP_CH1_SHIFT;

         break;

     case CSI_MEM2:

         temp &= ~SMFC_MAP_CH2_MASK;

-        temp |= ((csi << 2) | mipi_id) << SMFC_MAP_CH2_SHIFT;

+        temp |= ((csi << 2) | id) << SMFC_MAP_CH2_SHIFT;

         break;

     case CSI_MEM3:

         temp &= ~SMFC_MAP_CH3_MASK;

-        temp |= ((csi << 2) | mipi_id) << SMFC_MAP_CH3_SHIFT;

+        temp |= ((csi << 2) | id) << SMFC_MAP_CH3_SHIFT;

         break;

     default:

         return;

--

1.7.0.4

0 Kudos
5,236 Views
chrisroed
Contributor IV

I've had some better luck getting this to work.  There was some issue in mxc_v4l2_capture.c that it wasn't setting the external_vsync or the pixel formats properly.  I had to hardcode those values.

I also had to modify the gstreamer-imx plugin (gstreamer-imx/src/v4l2/v4l2src.c) to hardcode video/x-bayer, format=bggr.

Using gstreamer I can use the command

$gst-launch-1.0 imxv4l2videosrc ! video/x-bayer,format=bggr,width=1280,height=720,framerate=30/1 ! bayer2rgb ! imxipuvideosink

and get a video output to my display.  There still appears to be a tracking issue and a color issue that I'm hoping someone can comment on.  When gstreamer starts, It usually starts with something like this

pastedImage_2.png

In the bluish section you can clearly see the bayer pattern if you zoom in.  Eventually, the tracking lines up correctly and the image doesn't have the bayer mosaic but it's stuck with that greenish color.  Is there another gstreamer plugin I can put in the pipeline to fix that?

0 Kudos
5,236 Views
jimmychan
NXP TechSupport
NXP TechSupport

When I am porting the ov5645, I also met the color issue. After I got the ov5645 application note and then fine tune the reg. values, the color problem solved.

Are you using the same reg. values in ov5640.c driver for your ov5648.c? If yes, that may be the problem. Because different OV cameras have different reg. setting values. And there are some hidden registers that cannot be found in the camera datasheet. Please ask OV or your camera supplier to provide you the proper reg. values for different resolutions (e.g. 15/30 fps, from 640x480 to 1080p) of ov5648. 

0 Kudos
5,236 Views
chrisroed
Contributor IV

Hehehe, yeah I'm finding out about the hidden registers that aren't mentioned in the datasheet.  I have been in contact with them and got the correct settings.

At this point, I decided to try the camera test patterns to see how the color compares.  I found that the test patterns came out with perfect color.  I'm thinking the issue now isn't a freescale issue, but something I'll have to work out with the folks at omnivision.  Thanks for the help, Jimmy.

0 Kudos
5,236 Views
chrisroed
Contributor IV

hi Jimmy,  Thanks for the response.  I have the ov5648 camera set up to run in virtual channel 0, so that patch had no effect on my image

0 Kudos
5,236 Views
jimmychan
NXP TechSupport
NXP TechSupport

I tried porting the OV5645 before. OV5645 Driver

I met the same problem as you. The problem solved after fix the CSI_MIPI_DI0_MASK and mipi_id=0.

The OV5640 reg_value cannot be used in the OV5645. After fine tuning the reg_value in each mode ov5645_setting_30fps_XXXX_XXX[], the color output become correct. The format I set is the 0x4300=0x32, it is UYVY. You may take the reg_value for reference.

0 Kudos
5,236 Views
chrisroed
Contributor IV

Jimmy,

I think the driver is working fine.  The issue is that the ov5648 will ONLY output bayer formatted raw8 bit data.  I actually tried to change the datatype to a pixel format that the IPU understands, but had no luck.

0 Kudos
5,236 Views
jimmychan
NXP TechSupport
NXP TechSupport

There is no ISP in i.MX6, so RAW data from camera can't be displayed even if it can be captured by CSI.

IPU - bayer pattern conversion

0 Kudos
5,235 Views
chrisroed
Contributor IV

Hi Jimmy,

Yes we are aware of that issue now.  The path forward is to use the CSI to capture the raw data, then use software to convert it to a usable format.

I've made a few changes from the previous entries, and now I'm unable to even capture a frame.  I've modified the mxc_v4l2_capture.c and the ipu files to accept V4L2_PIX_FMT_SBGGR8 and use IPU_PIX_FMT_GENERIC.  From other community suggestions, I've also enabled V4L2_PIX_FMT_GREY and IPU_PIX_FMT_GREY.  I changed the driver code to use either of those formats, then I slightly modified this example (Appendix D. Video Capture Example ) to capture just a single frame of data (1280x720 with V4L2_PIX_FMT_SBGGR8) so that I can then find a processing algorithm to convert the data correctly. (Note:  I *was* using gstreamer but gstreamer-imx doesn't accept video/x-bayer as a cap... since the ISP isn't in the IMX6, it would be very handy to at least of the software hooks to be able to get bayer images)

There's a few problems I'm running into.

1.   gstreamer would select camera index 1  (CSI MEM) and this capture program example always wants to use camera index 0 (CSI IC MEM).  I tried changing the  changed the v4l2_input structure so that both of the indexes point to CSI MEM.  That's an easy switch and the IPU channel is being set up properly.

2.  the example seemed to have problems setting the correct pixel format and setting the vsync_external flag.  I had to hardcode these for some reason.

Even so... when I try to grab a frame of raw data I get the following output

$./v4l2_capture -c 1 -f -o   <=== capture 1 frame, force to 1280x720 bayer, output to stdout

               In MVC: mxc_v4l_open

[   30.611576]    device name is Mxc Camera

[   30.611587] mxc_v4l_open: enabling CSI MEM

[   30.611600] ioctl_g_ifparm: ENTER

[   30.611608] ioctl_g_ifparm: MIDDLE

[   30.611621]    clock_curr=mclk=24000000

[   30.611628] ioctl_g_ifparm: EXIT

[   30.611640] End of mxc_v4l_open: v2f pix widthxheight 1280 x 720

[   30.611652] End of mxc_v4l_open: crop_bounds widthxheight 1280 x 720

[   30.611662] End of mxc_v4l_open: crop_defrect widthxheight 1280 x 720

[   30.611867] End of mxc_v4l_open: crop_current widthxheight 1280 x 720

[   30.611880] On Open: Input to ipu size is 1280 x 720

[   30.611900] In ipu_csi_init_interface on CSI0

[   30.611910] csi_init_interface: CSI using DATA_FMT_BAYER

[   30.611918] csi_init_interface set CSI_CSI_SENS_CONF_FMT

[   30.611947] imx-ipuv3 2400000.ipu: CSI_SENS_CONF = 0x00008B00               <==== external vsync set

[   30.611964] imx-ipuv3 2400000.ipu: CSI_ACT_FRM_SIZE = 0x02CF04FF

[   30.624100]    Setting mclk to 24 MHz

[   30.626484]  fps = 30

[   30.627514] mipi csi2 already enabled!

[   31.334479] OV5648_stream_on: status = 0x00000330

[   31.334495] OV5648_stream_on: error1 = 0x00000000

[   31.334506] OV5648_stream_on: error2 = 0x00000000

[   31.334515] ov5648 ioctl_dev_init ran

[   31.336964]    case VIDIOC_QUERYCAP

[   31.337014]    case VIDIOC_CROPCAP

[   31.337030]    case VIDIOC_S_CROP

[   31.337042]    Cropping Input to ipu size 1280 x 720

[   31.337067]    case VIDIOC_S_FMT

[   31.337074] In MVC: mxc_v4l2_s_fmt

[   31.337082]    type=V4L2_BUF_TYPE_VIDEO_CAPTURE

[   31.337094] mxc_v4l2_s_fmt: Setting format to V4L2_PIX_FMT_SBGGR8

[   31.337105] mxc_v4ls_s_fmt:  size: 921600

                bytesperline is 1280

[   31.337117] End of mxc_v4l2_s_fmt: v2f pix widthxheight 1280 x 720

[   31.337129] End of mxc_v4l2_s_fmt: crop_bounds widthxheight 1280 x 720

[   31.337139] End of mxc_v4l2_s_fmt: crop_defrect widthxheight 1280 x 720

[   31.337150] End of mxc_v4l2_s_fmt: crop_current widthxheight 1280 x 720

[   31.337166]    case VIDIOC_REQBUFS

[   31.337175] In MVC:mxc_streamoff

[   31.337183] MVC: In mxc_free_frame_buf

[   31.337193] In MVC:mxc_allocate_frame_buf - size=921600

[   31.356638]    case VIDIOC_QUERYBUF

[   31.356647] In MVC:mxc_v4l2_buffer_status

[   31.356669] In MVC:mxc_mmap

[   31.356677]    pgoff=0x24300, start=0x76cf7000, end=0x76dd8000

[   31.356702]    case VIDIOC_QUERYBUF

[   31.356706] In MVC:mxc_v4l2_buffer_status

[   31.356713] In MVC:mxc_mmap

[   31.356718]    pgoff=0x24400, start=0x76c16000, end=0x76cf7000

[   31.356740]    case VIDIOC_QUERYBUF

[   31.356743] In MVC:mxc_v4l2_buffer_status

[   31.356750] In MVC:mxc_mmap

[   31.356755]    pgoff=0x24500, start=0x76b35000, end=0x76c16000

[   31.356784]    case VIDIOC_QUERYBUF

[   31.356788] In MVC:mxc_v4l2_buffer_status

[   31.356795] In MVC:mxc_mmap

[   31.356799]    pgoff=0x24600, start=0x76a54000, end=0x76b35000

[   31.356823]    case VIDIOC_QBUF

[   31.356828]    case VIDIOC_QBUF

[   31.356833]    case VIDIOC_QBUF

[   31.356837]    case VIDIOC_QBUF

[   31.356843]    case VIDIOC_STREAMON

[   31.356846] In MVC:mxc_streamon

[   31.356850] IPU:In csi_enc_enabling_tasks

[   31.358269] In csi_enc_setup with format 0x31384142          <=== BA81 for SBGGR8

[   31.358277] csi_enc_setup has CSI0

[   31.358282] csi_enc_setup: Setting IPU_PIX_FMT_GENERIC

[   31.358300] imx-ipuv3 2400000.ipu: init channel = 15

[   31.358308] ipu_init_channel: configuring SMFC for MIPI CSI0

[   31.358314] _ipu_csi_init: CSI0 data going to IDMAC

[   31.358318] IPU register dump after ipu_init_channel

[   31.358325] imx-ipuv3 2400000.ipu: IPU_CONF =        0x10000661

[   31.358332] imx-ipuv3 2400000.ipu: IDMAC_CONF =      0x0000002F

[   31.358339] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN1 =   0x00800000

[   31.358346] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN2 =   0x00000000

[   31.358353] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI1 =  0x18800001

[   31.358360] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI2 =  0x00000000

[   31.358368] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN1 =  0x00000000

[   31.358374] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN2 =  0x00000000

[   31.358381] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL0 =    0x00000000

[   31.358389] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL1 =    0x00000000

[   31.358395] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN =    0x00000090

[   31.358402] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN_DEF =        0x202020F6

[   31.358409] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN =    0x00009694

[   31.358416] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN_DEF =        0x2020F6F6

[   31.358422] imx-ipuv3 2400000.ipu: DMFC_IC_CTRL =    0x00000002

[   31.358429] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW1 =       0x00000000

[   31.358435] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW2 =       0x00000000

[   31.358442] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW3 =       0x00000000

[   31.358448] imx-ipuv3 2400000.ipu: IPU_FS_DISP_FLOW1 =       0x00000000

[   31.358455] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_FSIZE =      0x00000000

[   31.358461] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_C =  0x00000000

[   31.358469] imx-ipuv3 2400000.ipu: IPU_IC_CONF =     0x00000000

[   31.358475] imx-ipuv3 2400000.ipu: CSI0_SENS_CONF =  0x04000B20                   <==== External vsync cleared for some reason

[   31.358481] imx-ipuv3 2400000.ipu: CSI0_SENS_FRM_SIZE =      0x02CF04FF

[   31.358487] imx-ipuv3 2400000.ipu: CSI0_SENS_ACT_SIZE =      0x02CF04FF

[   31.358494] imx-ipuv3 2400000.ipu: CSI0_OUT_FRM_CTRL =       0x00000000

[   31.358500] imx-ipuv3 2400000.ipu: CSI0_TST_CTRL =   0x00000000

[   31.358508] imx-ipuv3 2400000.ipu: CSI0_CCIR_CODE_1 =        0x00000000

[   31.358514] imx-ipuv3 2400000.ipu: CSI0_CCIR_CODE_2 =        0x00000000

[   31.358520] imx-ipuv3 2400000.ipu: CSI0_DI =         0xFFFFFF2A

[   31.358527] imx-ipuv3 2400000.ipu: CSI0_SKIP =       0x00000000

[   31.358534] imx-ipuv3 2400000.ipu: CSI0_CPD_CTRL =   0x00000000

[   31.358539] ipu_common: bytes_per_pixel set to 1

[   31.358543] _ipu_channel_param_init: Setting IDMAC channel parameters for IPU_PIX_FMT_GENERIC

[   31.358551] imx-ipuv3 2400000.ipu: initializing idma ch 0 @ a08c0000

[   31.358559] _ipu_channel_param_init: dumping ipu channel param info

[   31.358567] imx-ipuv3 2400000.ipu: ch 0 word 0 - 00000000 00000000 00000000 E0002800 000B3C9F

[   31.358576] imx-ipuv3 2400000.ipu: ch 0 word 1 - 048E0000 0091C000 00CFC000 00013FC0 00000000

[   31.358582] imx-ipuv3 2400000.ipu: PFS 0x6,                                                        <==== pixel format generic

[   31.358588] imx-ipuv3 2400000.ipu: BPP 0x5,                                         <===== 8 bits/pixel

[   31.358594] imx-ipuv3 2400000.ipu: NPB 0x3f                                          <===== burst size is 64 pixels

[   31.358600] imx-ipuv3 2400000.ipu: FW 1279,

[   31.358606] imx-ipuv3 2400000.ipu: FH 719,

[   31.358613] imx-ipuv3 2400000.ipu: EBA0 0x24700000

[   31.358619] imx-ipuv3 2400000.ipu: EBA1 0x24700000

[   31.358625] imx-ipuv3 2400000.ipu: Stride 1279

[   31.358631] imx-ipuv3 2400000.ipu: scan_order 0

[   31.358637] imx-ipuv3 2400000.ipu: uv_stride 0

[   31.358643] imx-ipuv3 2400000.ipu: u_offset 0x0

[   31.358651] imx-ipuv3 2400000.ipu: v_offset 0x0

[   31.358656] imx-ipuv3 2400000.ipu: Width0 0+1,

[   31.358663] imx-ipuv3 2400000.ipu: Width1 0+1,

[   31.358669] imx-ipuv3 2400000.ipu: Width2 0+1,

[   31.358675] imx-ipuv3 2400000.ipu: Width3 0+1,

[   31.358680] imx-ipuv3 2400000.ipu: Offset0 0,

[   31.358686] imx-ipuv3 2400000.ipu: Offset1 0,

[   31.358692] imx-ipuv3 2400000.ipu: Offset2 0,

[   31.358698] imx-ipuv3 2400000.ipu: Offset3 0

[   31.358703] ipu_init_channel_buffer: detected SMFC channel, burst size is 64 bits

[   31.358708] !!! setting RWS enable for generic sensor

[   31.358863] ipu_enable_channel: Enabling IPU channel

[   31.358869] eba 24300000

[   31.358874] eba 24400000

[   31.358880] got to csi_enc_enable_csi

[   31.358883] In ipu_enable_csi

[   31.358887] ipu_enable_csi: Enabling CSI 0

[   31.358891] Dumping IPU registers from ipu_enable_csi:

[   31.358898] imx-ipuv3 2400000.ipu: IPU_CONF =        0x10000761

[   31.358904] imx-ipuv3 2400000.ipu: IDMAC_CONF =      0x0000002F

[   31.358910] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN1 =   0x00800001

[   31.358918] imx-ipuv3 2400000.ipu: IDMAC_CHA_EN2 =   0x00000000

[   31.358924] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI1 =  0x18800001

[   31.358931] imx-ipuv3 2400000.ipu: IDMAC_CHA_PRI2 =  0x00000000

[   31.358937] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN1 =  0x00000000

[   31.358944] imx-ipuv3 2400000.ipu: IDMAC_BAND_EN2 =  0x00000000

[   31.358952] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL0 =    0x00000001

[   31.358957] imx-ipuv3 2400000.ipu: IPU_CHA_DB_MODE_SEL1 =    0x00000000

[   31.358964] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN =    0x00000090

[   31.358970] imx-ipuv3 2400000.ipu: DMFC_WR_CHAN_DEF =        0x202020F6

[   31.358976] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN =    0x00009694

[   31.358982] imx-ipuv3 2400000.ipu: DMFC_DP_CHAN_DEF =        0x2020F6F6

[   31.358989] imx-ipuv3 2400000.ipu: DMFC_IC_CTRL =    0x00000002

[   31.358995] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW1 =       0x00000000

[   31.359001] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW2 =       0x00000000

[   31.359009] imx-ipuv3 2400000.ipu: IPU_FS_PROC_FLOW3 =       0x00000000

[   31.359015] imx-ipuv3 2400000.ipu: IPU_FS_DISP_FLOW1 =       0x00000000

[   31.359021] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_FSIZE =      0x00000000

[   31.359029] imx-ipuv3 2400000.ipu: IPU_VDIC_VDI_C =  0x00000000

[   31.359035] imx-ipuv3 2400000.ipu: IPU_IC_CONF =     0x40000000              <==== RWS_EN

[   31.359042] imx-ipuv3 2400000.ipu: CSI0_SENS_CONF =  0x04008B20

[   31.359048] imx-ipuv3 2400000.ipu: CSI0_SENS_FRM_SIZE =      0x02CF04FF     <==== got data (this was 0 when external vsync=0)

[   31.359054] imx-ipuv3 2400000.ipu: CSI0_SENS_ACT_SIZE =      0x02CF04FF    <===== actual size

[   31.359060] imx-ipuv3 2400000.ipu: CSI0_OUT_FRM_CTRL =       0x00000000

[   31.359066] imx-ipuv3 2400000.ipu: CSI0_TST_CTRL =   0x00000000

[   31.359074] imx-ipuv3 2400000.ipu: CSI0_CCIR_CODE_1 =        0x00000000

[   31.359080] imx-ipuv3 2400000.ipu: CSI0_CCIR_CODE_2 =        0x00000000

[   31.359085] imx-ipuv3 2400000.ipu: CSI0_DI =         0xFFFFFF2A

[   31.359093] imx-ipuv3 2400000.ipu: CSI0_SKIP =       0x00000000

[   31.359100] imx-ipuv3 2400000.ipu: CSI0_CPD_CTRL =   0x00000000

Everything looks alright, and according to those last few lines there, it looks like the CSI module has actually received a frame but isn't setting the EOF bit.

Got any suggestions?

0 Kudos