AnsweredAssumed Answered

Connecting OV2640 camera to CSI0 in parallel mode

Question asked by Krzysztof Szałach on May 14, 2015
Latest reply on Jun 2, 2015 by Wigros Sun

Hello, we're trying to connect OV2640 camera to CSI0 in parallel mode. What we have achieved till now:

  1. added OV2640 driver to kernel compliation
  2. have working clock on CLKO2 output
  3. OV2640 i2c interface is recognized by kernel as it locks proper (0x30) address on i2c bus
  4. made changes in board-mx6q_var_som.c as follows:
    1. in static void mx6q_mipi_sensor_io_init(void) added
      if (cpu_is_mx6q())
         mxc_iomux_set_gpr_register(1, 19, 1, 1) // enable csi0
    2. changed static struct fsl_mxc_camera_platform_data mipi_csi2_data = {
         .mclk = 24000000,
         .mcl_source = 0,
         .csi = 0,
         .io_init = mx6q_mipi_sensor_io_init,
         .pwdn = mx6q_mipi_powerdown,
      }
    3. added i2c device in static struct i2c_board_info mxc_i2c2_board_info[] __initdata = {
         {
            I2C_BOARD_INFO("ov2640", 0x30),
            .platform_data = (void *)&mipi_csi2_data
      }
    4. changed static struct fsl_mxc_capture_platform_data capture_data[] = {
        .csi = 0,
         .ipu = 1,
         .mclk_source = 0,
         .is_mipi = 0,
      }
    5. in static void __init mx6_var_som_board_init(void) {
         ...
        imx6q_add_v4l2_capture(0, &capture_data[0]);
         voutdev = imx6q_add_v4l2_output(0);
         ...
      }
      and removed imx6q_add_mipi_csi2(&mipi_csi2_pdata)
  5. added port mux in board-mx6q_var_som.h:
    MX6Q_PAD_CSI0_DAT12__IPU1_CSI0_D_12
    MX6Q_PAD_CSI0_DAT13__IPU1_CSI0_D_13
    MX6Q_PAD_CSI0_DAT14__IPU1_CSI0_D_14
    MX6Q_PAD_CSI0_DAT15__IPU1_CSI0_D_15
    MX6Q_PAD_CSI0_DAT16__IPU1_CSI0_D_16
    MX6Q_PAD_CSI0_DAT17__IPU1_CSI0_D_17
    MX6Q_PAD_CSI0_DAT18__IPU1_CSI0_D_18
    MX6Q_PAD_CSI0_DAT19__IPU1_CSI0_D_19
    MX6Q_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC
    MX6Q_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC
    MX6Q_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK
    MX6Q_PAD_GPIO_7__GPIO_1_7
    MX6Q_PAD_GPIO_8__GPIO_1_8
  6. changed in init.rc
    setprop back_camera_name ov2640

From dmesg:

Linux video capture interface: v2.00

mxc_v4l2_output mxc_v4l2_output.0: V4L2 device registered as video16

mxc_v4l2_output mxc_v4l2_output.0: V4L2 device registered as video17

usbcore: registered new interface driver uvcvideo

USB Video Class driver (v1.1.0)

 

And finally when we open Camera2 apk we see error - Can't connetc to camera. It all looks like ov2640 driver is not working properly. It allocates i2c bus resources, but something is wrong. Did we miss anything in the configuration?

Outcomes