Problems with OV5640 MIPI

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

Problems with OV5640 MIPI

3,863 Views
shree97
Contributor II

Hello all,

I am trying to interface the OV5640MIPI camera with our custom board running on i-MX6 solo.In our schematics below signals are coming to MIPI connector from processor:

1)MIPI_CSI_CLK0_N

2)MIPI_CSI_CLK0_P

3)MIPI_CSI_D0_N

4)MIPI_CSI_D0_P

5)MIPI_CSI_D1_N

6)MIPI_CSI_D1_P

7)CAM_PWR_EN(GPIO) from pad CSI0_DAT18

8)CAM_PWDN_3V3 (GPIO) from pad CSI0_DAT14

9)CAM_RESET_3V3(GPIO) from pad CSI0_DAT15

After that I referred many device tree files but I didn't find this pin muxing in any DTSI file which are using MIPI camera.Instead of that I found below pin-muxing in every dtsi file which are using MIPI camera:

pinctrl_ipu1_2: ipu1grp-2 { /* parallel camera */

            fsl,pins = <

                MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12    0x80000000

                MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13    0x80000000

                MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14    0x80000000

                MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15    0x80000000

                MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16    0x80000000

                MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17    0x80000000

                MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18    0x80000000

                MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19    0x80000000

                MX6QDL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x80000000

                MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK   0x80000000

                MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC      0x80000000

                MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC     0x80000000

            >;

        };

So my question is are this Pin muxing is necessary for MIPI camera to work ? In our schematics this pads are ued for other functionalities like UART,I2S,GPIO etc, So is it causing problem.

By referring all these DTSI files I modified my DTSI file as below:

pinctrl_ipu1_2: ipu1grp-2 { /* parallel camera */

            fsl,pins = <

                MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12    0x80000000

                MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13    0x80000000

                MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14    0x80000000

                MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15    0x80000000

                MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16    0x80000000

                MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17    0x80000000

                MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18    0x80000000

                MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19    0x80000000

                MX6QDL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x80000000

                MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK   0x80000000

                MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC      0x80000000

                MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC     0x80000000

            >;

        };

&i2c3 {

    clock-frequency = <100000>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_i2c3>;

    status = "okay";

   

    ft5x06_ts@38 {

        compatible = "ft5x06-ts";

        reg = <0x38>;

                interrupts-extended = GPIRQ_I2C3_J7;

        wakeup-gpios = GP_I2C3_J7;

    };

    ov5640_mipi: ov5640_mipi@3c { /* i2c2 driver */

        compatible = "ovti,ov5640_mipi";

        reg = <0x3c>;

        //pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_ipu1_2>;

        clocks = <&clks 201>;

        clock-names = "csi_mclk";

        DOVDD-supply = <&wlan_en_reg>; /* 1.8v */

        AVDD-supply = <&vgen3_reg>;  /* 2.8v, rev C board is VGEN3

                        rev B board is VGEN5 */

        DVDD-supply = <&vgen2_reg>;  /* 1.5v*/

        pwn-gpios = <&gpio6 00 1>;   /* active low: SD1_CLK */

        rst-gpios = <&gpio6 01 0>;   /* active high: SD1_DAT2 */

        csi_id = <1>;

        mclk = <24000000>;

        mclk_source = <0>;

    };

};

&i2c3 {

    clock-frequency = <100000>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_i2c3>;

    status = "okay";

   

    ft5x06_ts@38 {

        compatible = "ft5x06-ts";

        reg = <0x38>;

                interrupts-extended = GPIRQ_I2C3_J7;

        wakeup-gpios = GP_I2C3_J7;

    };

    ov5640_mipi: ov5640_mipi@3c { /* i2c2 driver */

        compatible = "ovti,ov5640_mipi";

        reg = <0x3c>;

        //pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_ipu1_2>;

        clocks = <&clks 201>;

        clock-names = "csi_mclk";

        DOVDD-supply = <&wlan_en_reg>; /* 1.8v */

        AVDD-supply = <&vgen3_reg>;  /* 2.8v, rev C board is VGEN3

                        rev B board is VGEN5 */

        DVDD-supply = <&vgen2_reg>;  /* 1.5v*/

        pwn-gpios = <&gpio6 00 1>;   /* active low: SD1_CLK */

        rst-gpios = <&gpio6 01 0>;   /* active high: SD1_DAT2 */

        csi_id = <1>;

        mclk = <24000000>;

        mclk_source = <0>;

    };

};

&mipi_csi {

    status = "okay";

    ipu_id = <0>;

    csi_id = <1>;

    v_channel = <0>;

    lanes = <2>;

};

but its giving below errors after inserting ov5640_camera_mipi.ko

ov5640_read_reg:write reg error:reg=300a                                  

camera ov5640_mipi is not found

Kindly help regarding this issue.

Thanks & Regards,

Shrikant

Tags (2)
0 Kudos
Reply
11 Replies

2,803 Views
igorpadykov
NXP Employee
NXP Employee

Hi shree97

MIPI_CSI_ are analog signals and not muxed with other signals.

not found error may be related to i2c miscommunication, for example on

below example camera is connected to i2c2:

linux-2.6-imx.git - Freescale i.MX Linux Tree

So it makes sense to check i2c communication with oscilloscope.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

2,803 Views
shree97
Contributor II

Hi igorpadykov,

I modified the DTSi file as below :

.

.

.

v4l2_cap_0 {

        compatible = "fsl,imx6q-v4l2-capture";

        ipu_id = <0>;

        csi_id = <0>;

        mclk_source = <0>;

        status = "okay";

    };

    v4l2_cap_1 {

        compatible = "fsl,imx6q-v4l2-capture";

        ipu_id = <0>;

        csi_id = <1>;

        mclk_source = <0>;

        status = "okay";

    };

    v4l2_out {

        compatible = "fsl,mxc_v4l2_output";

        status = "okay";

    };

pinctrl_i2c3: i2c3grp {

            fsl,pins = <

                MX6QDL_PAD_EIM_D18__I2C3_SDA        0x4001b8b1

                MX6QDL_PAD_EIM_D17__I2C3_SCL        0x4001b8b1

                MX6QDL_PAD_EIM_D21__GPIO3_IO21         0x1b0b0   // For Touchscreen Reset

            #define GPIRQ_I2C3_J7    <&gpio4 20 IRQ_TYPE_EDGE_FALLING>

            #define GP_I2C3_J7 <&gpio4 20 GPIO_ACTIVE_LOW>

                MX6QDL_PAD_DI0_PIN4__GPIO4_IO20       0x1b0b0  //For Touch Interrupt

            >;

        };

&i2c3 {

    clock-frequency = <100000>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_i2c3>;

    status = "okay";

   

    ft5x06_ts@38 {

        compatible = "ft5x06-ts";

        reg = <0x38>;

                interrupts-extended = GPIRQ_I2C3_J7;

        wakeup-gpios = GP_I2C3_J7;

    };

    ov5640_mipi: ov5640_mipi@3c { /* i2c2 driver */

        compatible = "ovti,ov5640_mipi";

        reg = <0x3c>;

        //pinctrl-names = "default";

        //pinctrl-0 = <&pinctrl_ipu1_2>;

        clocks = <&clks 201>;

        clock-names = "csi_mclk";

        DOVDD-supply = <&wlan_en_reg>; /* 1.8v */

        AVDD-supply = <&vgen3_reg>;  /* 2.8v, rev C board is VGEN3

                        rev B board is VGEN5 */

        DVDD-supply = <&vgen2_reg>;  /* 1.5v*/

        pwn-gpios = <&gpio6 00 1>;   /* active low: SD1_CLK */

        rst-gpios = <&gpio6 01 0>;   /* active high: SD1_DAT2 */

        csi_id = <1>;

        mclk = <24000000>;

        mclk_source = <0>;

    };

};

&mipi_csi {

    status = "okay";

    ipu_id = <0>;

    csi_id = <1>;

    v_channel = <0>;

    lanes = <2>;

};

after that I load the below modules and the response is as below:

root@imx6qdlsolo:~# insmod v4l2-int-device.ko

root@imx6qdlsolo:~# insmod ov5640_camera_int.ko

root@imx6qdlsolo:~# insmod ov5640_camera_mipi.ko

camera ov5640_mipi is found

root@imx6qdlsolo:~# insmod adv7180_tvin.ko

root@imx6qdlsolo:~# insmod ipu_prp_enc.ko

root@imx6qdlsolo:~# insmod ipu_fg_overlay_sdc.ko

root@imx6qdlsolo:~# insmod ipu_still.ko

root@imx6qdlsolo:~# insmod ipu_csi_enc.ko

root@imx6qdlsolo:~# insmod ipu_bg_overlay_sdc.ko

root@imx6qdlsolo:~# insmod mxc_v4l2_capture.ko

root@imx6qdlsolo:~# ERROR: v4l2 capture: slave not found!

root@imx6qdlsolo:~# i2cdetect -y 2

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- UU -- -- -- UU -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --                        

Dmesg output related to camera:

write_reg: set register 0x00 to 0x00

set_mode: changed mode to 0x00

write_reg: set register 0x00 to 0x00

set_mode: changed mode to 0x00

camera ov5640_mipi is found

ERROR: v4l2 capture: slave not found!

Also I checked the Waveforms using logic analyzer.

Also I tried with the drivers as buit-in modules but I got the same errors.

cam.jpg

kindly give you suggestions regarding this issue.

Thanks & Regards,

Shrikant

0 Kudos
Reply

2,803 Views
bandarulavanya
Contributor V

Hi Shee97,

have you tried capturing using mxc_v4l2_capture.out . then what it is giving and can you disable ov5640 dvp related camera in menuconfig.

Thanks,

Lavanya

0 Kudos
Reply

2,803 Views
shree97
Contributor II

Hi Lavanya,

The output of ./mxc_v4l2_capture.out is as below:

root@imx6qdlsolo:/unit_tests# ./mxc_v4l2_capture.out

in_width = 176, in_height = 144ERROR: v4l2 capture: slave not found!

out_width = 176, out_height = 144

top = 0, left = 0

Unable to open /dev/video0

Unable to create y frame recording file

I am unable to debug this error "ERROR: v4l2 capture: slave not found!"

Thanks & Regards,

Shrikant

0 Kudos
Reply

2,803 Views
bandarulavanya
Contributor V

Hi Shrikant,

can you try probing pwd and rst pins status using oscilloscope. where the options for mxc_v4l2_capture.out

Thanks & regards,

Lavanya

0 Kudos
Reply

2,803 Views
bandarulavanya
Contributor V

Hi Shrikant,

can you try probing pwd and rst pins status using oscilloscope.

Thanks & regards,

Lavanya

0 Kudos
Reply

2,802 Views
bandarulavanya
Contributor V

Hi Shee97,

have you tried capturing using mxc_v4l2_capture.out . then what it is giving

Thanks,

Lavanya

0 Kudos
Reply

2,802 Views
bandarulavanya
Contributor V

Hi shree97 ,

It is looking like I2C Problem can you check once by probing I2C lines.

Thanks

Lavanya

0 Kudos
Reply

2,802 Views
shree97
Contributor II

Hi Lavanya,

I modified the DTSi file as below :

.

.

.

v4l2_cap_0 {

        compatible = "fsl,imx6q-v4l2-capture";

        ipu_id = <0>;

        csi_id = <0>;

        mclk_source = <0>;

        status = "okay";

    };

    v4l2_cap_1 {

        compatible = "fsl,imx6q-v4l2-capture";

        ipu_id = <0>;

        csi_id = <1>;

        mclk_source = <0>;

        status = "okay";

    };

    v4l2_out {

        compatible = "fsl,mxc_v4l2_output";

        status = "okay";

    };

pinctrl_i2c3: i2c3grp {

            fsl,pins = <

                MX6QDL_PAD_EIM_D18__I2C3_SDA        0x4001b8b1

                MX6QDL_PAD_EIM_D17__I2C3_SCL        0x4001b8b1

                MX6QDL_PAD_EIM_D21__GPIO3_IO21         0x1b0b0   // For Touchscreen Reset

            #define GPIRQ_I2C3_J7    <&gpio4 20 IRQ_TYPE_EDGE_FALLING>

            #define GP_I2C3_J7 <&gpio4 20 GPIO_ACTIVE_LOW>

                MX6QDL_PAD_DI0_PIN4__GPIO4_IO20       0x1b0b0  //For Touch Interrupt

            >;

        };

&i2c3 {

    clock-frequency = <100000>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_i2c3>;

    status = "okay";

   

    ft5x06_ts@38 {

        compatible = "ft5x06-ts";

        reg = <0x38>;

                interrupts-extended = GPIRQ_I2C3_J7;

        wakeup-gpios = GP_I2C3_J7;

    };

    ov5640_mipi: ov5640_mipi@3c { /* i2c2 driver */

        compatible = "ovti,ov5640_mipi";

        reg = <0x3c>;

        //pinctrl-names = "default";

        //pinctrl-0 = <&pinctrl_ipu1_2>;

        clocks = <&clks 201>;

        clock-names = "csi_mclk";

        DOVDD-supply = <&wlan_en_reg>; /* 1.8v */

        AVDD-supply = <&vgen3_reg>;  /* 2.8v, rev C board is VGEN3

                        rev B board is VGEN5 */

        DVDD-supply = <&vgen2_reg>;  /* 1.5v*/

        pwn-gpios = <&gpio6 00 1>;   /* active low: SD1_CLK */

        rst-gpios = <&gpio6 01 0>;   /* active high: SD1_DAT2 */

        csi_id = <1>;

        mclk = <24000000>;

        mclk_source = <0>;

    };

};

&mipi_csi {

    status = "okay";

    ipu_id = <0>;

    csi_id = <1>;

    v_channel = <0>;

    lanes = <2>;

};

after that I load the below modules and the response is as below:

root@imx6qdlsolo:~# insmod v4l2-int-device.ko

root@imx6qdlsolo:~# insmod ov5640_camera_int.ko

root@imx6qdlsolo:~# insmod ov5640_camera_mipi.ko

camera ov5640_mipi is found

root@imx6qdlsolo:~# insmod adv7180_tvin.ko

root@imx6qdlsolo:~# insmod ipu_prp_enc.ko

root@imx6qdlsolo:~# insmod ipu_fg_overlay_sdc.ko

root@imx6qdlsolo:~# insmod ipu_still.ko

root@imx6qdlsolo:~# insmod ipu_csi_enc.ko

root@imx6qdlsolo:~# insmod ipu_bg_overlay_sdc.ko

root@imx6qdlsolo:~# insmod mxc_v4l2_capture.ko

root@imx6qdlsolo:~# ERROR: v4l2 capture: slave not found!

root@imx6qdlsolo:~# i2cdetect -y 2

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- UU -- -- -- UU -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --                        

Dmesg output related to camera:

write_reg: set register 0x00 to 0x00

set_mode: changed mode to 0x00

write_reg: set register 0x00 to 0x00

set_mode: changed mode to 0x00

camera ov5640_mipi is found

ERROR: v4l2 capture: slave not found!

kindly help regarding this issue.

Thanks & Regards,

Shrikant

0 Kudos
Reply

2,803 Views
bandarulavanya
Contributor V

Hi shree97 ,

can you try once making your modules as static drivers and check whether same error is coming or not

Thanks & regards,

Lavanya

0 Kudos
Reply

2,803 Views
shree97
Contributor II

Hi Lavanya,

I tried the drivers as built in modules but still I am getting the same error as below:

ERROR: v4l2 capture: slave not found!

ERROR: v4l2 capture: slave not found!

Thanks & Regards,

Shrikant

0 Kudos
Reply