Jump to content

Recommended Posts

Posted

Hi, I've had orange pi one laying around and also couple of camera modules scrapped over different devices, which only one seems to be the "known" model of ov2640, which is supposed to be supported on linux mainline kernel, but unfortunately no module is compiled into armbian image, so I've had to compiled it solely for the running kernel.

 

After lot of digging into the thing, mostly getting inspiration from this forum and threads about 5640, I've tried crafting overlay, with different results. This is the latest attempt, which created /dev/vide0, but no /dev/media0 is made, and also loading module fails with:

[ 5812.695851] ov2640: loading out-of-tree module taints kernel.
[ 5812.696327] ov2640: module verification failed: signature and/or required key missing - tainting kernel
[ 5812.697838] ov2640: probe of 3-0030 failed with error -2

 

So no video input is possible.

 

There are also different outcomes I am able to get into, first is both /dev/video0 and media0 is made, but ov2640 does not auto load and manual loading makes no difference, second is, that /dev/video* is made but not media, and also I am missing the /dev/i2c* except the one from my overlay (even I have enabled other i2c overlays), next where it almost looks working module is autoloaded, but /dev/media topology does not contain ov2640, etc... depending what I change in the DTS overlay.

 

DTS:

/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun8i-h3";
};

&csi {
        status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&csi1_clk &csi1_8bit>;

        port {

                csi_ep: endpoint {
                        remote-endpoint = <&ov2640_ep>;
                        /*hsync-active = <0>;
                        vsync-active = <0>;*/
                        bus-width = <8>;
			data-active = <1>;
			pclk-sample = <1>;
                };
        };
};

&pio {
	csi1_8bit: csi1-8bit@0 {
	       pins = "PE4","PE5","PE6","PE7","PE8","PE9","PE10","PE11";
	       bias-disable;
	       function = "csi";
    	};

        csi_mclk_pin: csi-mclk-pin@0 {
                pins = "PE1";
                function = "csi";
		bias-disable;
        };
	
	csi1_clk: csi1-clk@0 {
		ins = "PE0","PE2","PE3";
	        bias-disable;
	        function = "csi";
 	};

	i2c2_pins: i2c2 {
		pins = "PE12", "PE13";
        	/*bias-pullup;*/
		function = "i2c2";
	};
};

&i2c2 {
	#address-cells = <1>;
	#size-cells = <0>;
        
	status = "okay";
	pinctrl-0 = <&i2c2_pins>;
	pinctrl-names = "default";

        ov2640: camera@30 {
                compatible = "ovti,ov2640";
                reg = <0x30>;
                pinctrl-names = "default";
                pinctrl-0 = <&csi_mclk_pin>;
                clocks = <&ccu 107>; /* CLK_CSI_MCLK, ref. https://elixir.bootlin.com/linux/v5.10.60/source/include/dt-bindings/clock/sun8i-h3-ccu.h#L140   */
                clock-names = "xclk";
        	assigned-clocks = <&ccu 107>;
        	assigned-clock-parents = <&osc24M>;
        	assigned-clock-rates = <24000000>;

                /*AVDD-supply = <&reg_vcc_af_csi>;
                DOVDD-supply = <&reg_vdd_1v5_csi>;
                DVDD-supply = <&reg_vcc_csi>; */
		enable-gpios = <&pio 0 17 1>;    /*  CSI-PWR-EN: BA17 */
                reset-gpios = <&pio 4 14 1>;      /*  CSI-RST-R: PE14 */
                powerdown-gpios = <&pio 4 15 0>;  /* CSI-STBY-R: PE15 */

                port {
                        ov2640_ep: endpoint {
                                remote-endpoint = <&csi_ep>;
                                bus-width = <8>;
				/*data-shift = <2>;*/
				data-active = <1>;
				pclk-sample = <1>;
				/*hsync-active = <0>; 
                        	vsync-active = <0>;*/
                        };
                };
        };
};

 

There's something on the i2c bus:

$ sudo i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: 30 31 32 33 34 35 36 -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                    

 

One thing I am not sure with is the bus-width as per ov2640 datasheet, the camera can output over 8 or 10 bits, but I have no idea how this is being controlled, or over which pins it goes as seems Opi one H3 have only 8 data pins.

Also what I do not know are the regulators/power supply (when enabling them, the other i2c 's disappears), and the things around the pinctrl... well to be honest I am not sure with anything here as my knowledge over crafting dts is limited and I am not sure what is(should) be controlled by driver, and what should be done by hardware/firmware.

 

Also one note, I've plugged the camera directly into the camera port, but I've googled some images where orage pi one have camera adapter (with some capacitors and resistors), so I am not sure if I am not missing this part.

 

Does have anyone some hints, where to look or what I am possibly missing here? As I feel I am running out of ideas...

 

 

 

 

 

 

Posted

I'm currently working on this also, although on a NanoPi Duo2 (Allwinner H3 based) and presumably a much newer kernel than what Durdin was using in mid-2021. 
 

However I'm not making much progress beyond what's described above. 
 

I guess my initial question is: is this even possible? Has anyone ever gotten the OV2640 working with an H3-based platform, on a "real" (i.e. not one of the sketchy vendor kernels full of mysterious blobs and GPL violations) kernel plus the appropriate module and overlay file?

 

If this is a fools errand and I'd be better just writing-off these OV2640 modules and buying OV5640s instead (which seem to be better supported these days), that would be great to know before I invest a whole bunch of time beating my head against the problem!

 

It seems like a natural enough combination (cheap board, cheap camera) that if nobody has gotten it to work before ever, I'm a bit suspicious that there's something not good about it, and maybe I need to rethink the hardware. 

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.

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines