2381699_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2381699_en-US

2381699_en-US

IMX8MP with OV5648 lock on taking photo

Hello. I'm trying to add OV5648 sensor to IMX8MP. Here is my dts setup

	ov5648_osc: camera-clk {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <24000000>;
		clock-output-names = "ov5648_xvclk";
	};

...
        ov5648_0: cam_ov5648_0@36 {
		compatible = "ovti,ov5648";
		reg = <0x36>;

		clocks = <&ov5648_osc>;
		clock-names = "xvclk";

		powerdown-gpios = <&io_expander 1 GPIO_ACTIVE_LOW>;

		dovdd-supply = <&ov5648_0_dovdd>;
		dvdd-supply = <&ov5648_0_dvdd>;
		status = "okay";

		csi_id = <0>;

		#address-cells = <1>;
		#size-cells = <0>;

		port@0 {
			reg = <0>;
			ov5648_0_mipi_ep: endpoint {
				remote-endpoint = <&mipi_csi_0_in>;
				link-frequencies = /bits/ 64 <210000000 168000000>;
				data-lanes = <1 2>;
				clock-lanes = <0>;
			};
		};
	};
...

&mipi_csi_0 {
	status = "okay";
	clock-frequency = <168000000>;

	port {
		mipi_csi_0_in: endpoint {
			remote-endpoint = <&ov5648_0_mipi_ep>;
			// imx8-mipi-csi2-sam.c doesn't care it's usually <1 2>...
			data-lanes = <2>;
			csis-hs-settle = <13>;
			csis-clk-settle = <2>;
			csis-wclk;
		};
	};
};
...
&isi_0 {
	status = "okay";
	cap_device {
		status = "okay";
	};
	m2m_device {
		status = "disabled";
	};
};

I'm trying to take photo with following command

v4l2-ctl -d /dev/video2 -v width=1280,height=720,pixelformat=YUYV --stream-mmap --stream-count=1 --stream-to=photo.raw

I have also added some debug prints to dmesg.

[  224.928864] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_cap_streamon:1107
[  224.940895] ov5648 2-0036: /drivers/media/i2c/ov5648.c:ov5648_s_power:2472 on 1
[  224.950246] ov5648 2-0036: /drivers/media/i2c/ov5648.c:ov5648_resume:2434
[  224.959057] ov5648 2-0036: /drivers/media/i2c/ov5648.c:ov5648_sensor_power:1870 on 1 
[  225.004545] ov5648 2-0036: /drivers/media/i2c/ov5648.c:ov5648_sensor_init:1797
[  225.037496] ov5648 2-0036: /drivers/media/i2c/ov5648.c:ov5648_s_power:2480 ov5648_resume ret 0
[  225.053146] input fmt RGB4
[  225.055866] output fmt YUYV
[  225.058682] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_cap_streamon:1118 mxc_isi_config_parm ret 0
f[  225.073740] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_cap_streamon:1124 vb2_ioctl_streamon ret 0
[  225.087962] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_pipeline_enable:124 media_graph_walk_init ret 0
[  225.102609] ov5648 2-0036: /drivers/media/i2c/ov5648.c:ov5648_s_stream:2146 enable 1
[  225.112697] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_pipeline_enable:149 v4l2_subdev_call s_stream ret 0 ov5648 2-0036 ov5648 2-0036
[  225.140978] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_pipeline_enable:149 v4l2_subdev_call s_stream ret 0 mxc-mipi-csi2.0 mxc-mipi-csi2.0
[  225.158893] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_pipeline_enable:149 v4l2_subdev_call s_stream ret -515 mxc_isi.0 mxc_isi.0
[  225.175873] isi-capture 32e00000.isi:cap_device: /drivers/staging/media/imx/imx8-isi-cap.c:mxc_isi_cap_streamon:1136 mxc_isi_pipeline_enable ret -515
[  225.190760] /drivers/media/v4l2-core/v4l2-ioctl.c:__video_do_ioctl:3145 info->func() ret 0
[  225.200349] /drivers/media/v4l2-core/v4l2-ioctl.c:video_usercopy:3490 trace()
[  225.208805] /drivers/media/v4l2-core/v4l2-ioctl.c:video_usercopy:3515 in_compat_syscall()
[  225.218306] /drivers/media/v4l2-core/v4l2-ioctl.c:video_usercopy:3532 video_put_user()
[  225.227569] /drivers/media/v4l2-core/v4l2-ioctl.c:video_usercopy:3438
[  225.235336] /drivers/media/v4l2-core/v4l2-ioctl.c:video_usercopy:3458 check_array_args()
[  225.244760] /drivers/media/v4l2-core/v4l2-ioctl.c:video_usercopy:3482 func()
[  225.253136] /drivers/media/v4l2-core/v4l2-ioctl.c:__video_do_ioctl:3133 info->func()

End of this log shows where the code locks while v4l command waits on. I have also started the command with strace and I see:

ioctl(3, VIDIOC_QBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, index=2, memory=V4L2_MEMORY_MMAP, m.offset=0xceb922f0, length=1, bytesused=0, flags=V4L2_BUF_FLAG_MAPPED|V4L2_BUF_FLAG_QUEUED|V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC|V4L2_BUF_FLAG_TSTAMP_SRC_EOF, ...}) = 0
ioctl(3, VIDIOC_QBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, index=3, memory=V4L2_MEMORY_MMAP, m.offset=0xceb922f0, length=1, bytesused=0, flags=V4L2_BUF_FLAG_MAPPED|V4L2_BUF_FLAG_QUEUED|V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC|V4L2_BUF_FLAG_TSTAMP_SRC_EOF, ...}) = 0
ioctl(3, VIDIOC_G_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=1280, height=720, pixelformat=v4l2_fourcc('Y', 'U', 'Y', 'V') /* V4L2_PIX_FMT_YUYV */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_SRGB, plane_fmt=[{sizeimage=1843200, bytesperline=2560}], num_planes=1}}) = 0
ioctl(3, VIDIOC_STREAMON, [V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE]) = 0
pselect6(4, NULL, NULL, [3], {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE

You can see it waits on the VIDIOC_DQBUF. I'm sure camera transitions from the LP mode into HS mode correctly.

Looks like the MIPI CSI never signals that the data has been received.

I'm using staging drivers from linux-imx kernel.

i.MX 8 Family | i.MX 8QuadMax (8QM) | 8QuadPlusi.MX 8M | i.MX 8M Mini | i.MX 8M NanoRe: IMX8MP with OV5648 lock on taking photo

I'm seeing that the csi interrupt counter goes up when i start the stream

 25:     365486          0          0          0     GICv3  49 Level     32e40000.csi
 26:          0          0          0          0     GICv3  48 Level     32e00000.isi

The ISI interrupts however stay at 0.

I have also enabled debug prints on the mxc-mipi-csi2 and it looks like I'm getting errors on the SOT

[ 2231.150985] mxc-mipi-csi2.0: mipi_csis_s_stream: 1, state: 0x0
[ 2231.151200] mxc-mipi-csi2.0: mipi_csis_imx8mp_phy_reset: bus fmt is 8 bit!
[ 2231.151240] mxc-mipi-csi2.0: fmt: 0x3001, 1280 x 720
[ 2231.151270] mxc-mipi-csi2.0: SOT Error: 1
[ 2231.151275] mxc-mipi-csi2.0: status: 00030000
[ 2231.151294] mxc-mipi-csi2.0: SOT Error: 2
[ 2231.151298] mxc-mipi-csi2.0: status: 00030000
[ 2231.151317] mxc-mipi-csi2.0: SOT Error: 3
[ 2231.151321] mxc-mipi-csi2.0: status: 00030000
[ 2231.151337] mxc-mipi-csi2.0: SOT Error: 4
[ 2231.151341] mxc-mipi-csi2.0: status: 00030000
[ 2231.151360] mxc-mipi-csi2.0: SOT Error: 5
[ 2231.151367] mxc-mipi-csi2.0: status: 00010000
[ 2231.151383] mxc-mipi-csi2.0: SOT Error: 6
[ 2231.151389] mxc-mipi-csi2.0: status: 00010000
[ 2231.151407] mxc-mipi-csi2.0: SOT Error: 7
[ 2231.151413] mxc-mipi-csi2.0: status: 00010000
[ 2231.151440] mxc-mipi-csi2.0: SOT Error: 8
[ 2231.151444] mxc-mipi-csi2.0: status: 00010000

Re: IMX8MP with OV5648 lock on taking photo

You need to update csis-hs-settle property in the dts according to the date rate of the connected camera module. More details can be found in the application note AN13857, section 3.2.5.

https://www.nxp.com/webapp/Download?colCode=AN13857

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎06-19-2026 03:29 AM
更新者: