OV5647 Driver Probing Failed (Cannot see it using i2cdetect)

Hello I in the middle of developing a driver for OV5647 camera on Jetson Nano. I have B01 version. I have followed the linux driver structure and used an OV5647 driver from an another kernel version. Finally I could load the driver and read device tree properties like pwdn and clk. Now I have to write to specific registers to initialize the camera. The problem is that I cannot see the camera on 0x36 address. I placed a camera minimal node under i2c@546c0000, which is supposed to be the i2c line for CSI interface, in the main dtb. This is the code I defined

		i2c@546c0000 {
			#address-cells = <0x01>;
			#size-cells = <0x00>;
			compatible = "nvidia,tegra210-vii2c";
			reg = <0x00 0x546c0000 0x00 0x34000>;
			iommus = <0x30 0x12>;
			interrupts = <0x00 0x11 0x04>;
			scl-gpio = <0x5b 0x92 0x00>;
			sda-gpio = <0x5b 0x93 0x00>;
			status = "okay";
			clocks = <0x26 0xd0 0x26 0x51 0x26 0x1c>;
			clock-names = "vii2c\0i2cslow\0host1x";
			resets = <0x26 0xd0>;
			reset-names = "vii2c";
			clock-frequency = <0x61a80>;
			bus-pullup-supply = <0x47>;
			avdd_dsi_csi-supply = <0x3b>;
			linux,phandle = <0xc8>;
			phandle = <0xc8>;
			
			ov5647@36 {
				compatible = "ovti,ov5647";
				reg = <0x36>;
				status = "okay";
				devnode = "video0";
				clocks = <0x26 0x117>;
				clock-names = "xclk";
				pwdn-gpios = <0x5b 0x97 0x00>;
				clock-noncontinuous = <0x00>;
			};

			ina3221x@40 {
				compatible = "ti,ina3221x";
				reg = <0x40>;
				status = "okay";
				ti,trigger-config = <0x7003>;
				ti,continuous-config = <0x7607>;
				ti,enable-forced-continuous;
				#io-channel-cells = <0x01>;
				#address-cells = <0x01>;
				#size-cells = <0x00>;
				linux,phandle = <0xaf>;
				phandle = <0xaf>;

				channel@0 {
					reg = <0x00>;
					ti,rail-name = "POM_5V_GPU";
					ti,shunt-resistor-mohm = <0x05>;
				};

				channel@1 {
					reg = <0x01>;
					ti,rail-name = "POM_5V_IN";
					ti,shunt-resistor-mohm = <0x05>;
				};

				channel@2 {
					reg = <0x02>;
					ti,rail-name = "POM_5V_CPU";
					ti,shunt-resistor-mohm = <0x05>;
				};
			};
		};

And this is the debugging messages I get when I insmod the driver:

[16600.208772] ov5647 6-0036: Starting probe function .....
[16600.208780] ov5647 6-0036: Passed if statements and starting memroty allocation 
[16600.208786] ov5647 6-0036: After memory allocation ...
[16600.208791] ov5647 6-0036: Before parsing clock_ncont ...
[16600.208797] ov5647 6-0036: After parsing clock_ncont: 0
[16600.208909] ov5647 6-0036: sensor->pwdn GPIO address: ffffffc0fa5df2e0, value: 0
[16600.208930] ov5647 6-0036: The parsed clock frequency is: 24000000
[16600.208972] ov5647 6-0036: Checking I2C client address: 0x36
[16600.208979] ov5647 6-0036: Checking device structure and client I2C adapter: 6-0036, ffffffc0f91b8828
[16600.208983] ov5647 6-0036: Powering on the device ....
[16600.208988] ov5647 6-0036: OV5647 power on
[16600.208993] ov5647 6-0036: PWDN is set to 0....
[16600.235489] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x36
[16600.242508] ov5647 6-0036: ov5647_write: i2c write error, reg: 3000
[16600.242515] ov5647 6-0036: write sensor_oe_enable_regs error
[16600.248277] ov5647: probe of 6-0036 failed with error -121

I hope someone can help me get it right. Thanks!

Make sure the sensor MCLK/PowerDown/Reset pin are in correct status.

Hello @KaremMohamed

You could take this patch as a reference for your driver in Jetson Nano NVIDIA-Jetson-IMX708-RPIV3/patches_nano/patches/4.6.4_nano_imx708_v0.1.0.patch at main · RidgeRun/NVIDIA-Jetson-IMX708-RPIV3 · GitHub

Hope this helps!

Regards!
Eduardo Salazar
Embedded SW Engineer at RidgeRun

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Thanks Shane, it is now recognized on the i2c bus 6. I had to initialize PWDN with 1 in the device tree and then set it to 0 in the driver. Now I can see UU at address 0x36. Thanks Eduardo for sharing that patch, it will benefit me in the future. Now I have to make sure I can read and write to the sensor’s registers, but that is a different topic.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.