0
@lex

tutorial Enable OV5640 on NanoPi A64

Recommended Posts

(edited)

This weekend I was revising and testing the OV5640 for some A64 boards.

To enable the Camera (OV5640) on NanoPi A64 for the mainline kernel you have to update the following:

* DT

* GPIO-I2C 

Here is the excerpt :

Spoiler

 


 {
    model = "FriendlyARM ...";
    .
    .
    reg_vcc3v3: vcc3v3 {
        compatible = "regulator-fixed";
        regulator-name = "vcc3v3";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
    };    
    
    cam_xclk: cam-xclk {
        #clock-cells = <0>;
        compatible = "fixed-clock";
        clock-frequency = <24000000>;
        clock-output-names = "cam-xclk";
    };

    reg_cam_avdd: cam-avdd {
        compatible = "regulator-fixed";
        regulator-name = "cam500b-avdd";
        regulator-min-microvolt = <2800000>;
        regulator-max-microvolt = <2800000>;
        vin-supply = <&reg_vcc3v3>;
    };

    reg_cam_dovdd: cam-dovdd {
        compatible = "regulator-fixed";
        regulator-name = "cam500b-dovdd";
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;
        vin-supply = <&reg_vcc3v3>;
    };

    reg_cam_dvdd: cam-dvdd {
        compatible = "regulator-fixed";
        regulator-name = "cam500b-dvdd";
        regulator-min-microvolt = <1500000>;
        regulator-max-microvolt = <1500000>;
        vin-supply = <&reg_vcc3v3>;
    };    
    
    i2c {
        compatible = "i2c-gpio";
        sda-gpios = <&pio 4 13 GPIO_ACTIVE_HIGH>;
        scl-gpios = <&pio 4 12 GPIO_ACTIVE_HIGH>;
        i2c-gpio,delay-us = <5>;
        #address-cells = <1>;
        #size-cells = <0>;

        ov5640: camera@3c {
            compatible = "ovti,ov5640";
            reg = <0x3c>;
            pinctrl-names = "default";
            pinctrl-0 = <&csi_mclk_pin>;
            clocks = <&ccu CLK_CSI_MCLK>;
            clock-names = "xclk";

            
            AVDD-supply = <&reg_cam_avdd>;
            DOVDD-supply = <&reg_cam_dovdd>;
            DVDD-supply = <&reg_cam_dvdd>;
            reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* CSI-RST-R: PE16 */
            powerdown-gpios = <&pio 4 17 GPIO_ACTIVE_HIGH>; /* CSI-STBY-R: PE17 */

            port {
                ov5640_ep: endpoint {
                    remote-endpoint = <&csi_ep>;
                    bus-width = <8>;
                    hsync-active = <1>; /* Active high */
                    vsync-active = <0>; /* Active low */
                    data-active = <1>;  /* Active high */
                    pclk-sample = <1>;  /* Rising */
                };
            };
        };
    };
};
          
&csi {
	status = "okay";

	port {
		csi_ep: endpoint {
			remote-endpoint = <&ov5640_ep>;
			bus-width = <8>;
			hsync-active = <1>; /* Active high */
			vsync-active = <0>; /* Active low */
			data-active = <1>;  /* Active high */
			pclk-sample = <1>;  /* Rising */
		};
	};
};
          

 

Kernel config:

 

CONFIG_I2C_GPIO=m

CONFIG_VIDEO_OV5640=m

CONFIG_VIDEO_SUN6I_CSI=m

 

Edited by @lex
added spoiler + csi

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0