Sensor选用如下型号:香橙派OrangePi_5 RK3588S IMX415
我使用的时候更换了镜头,将该sensor装在了我的变焦780模组上,经过后续测试因为CAM1相对稳定,所以安装在CAM1。安装位置如下:
rk3588s-orangepi-5-camera*.dtsi
修改设备树,以 kernel/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5-camera3.dtsi
为例,关闭 ov13855
,添加 imx415
:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (c) 2021 Rockchip Electronics Co., Ltd.
*
*/
&csi2_dcphy1 {
status = "disabled";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
mipi_in_dcphy0: endpoint@0 {
reg = <0>;
remote-endpoint = <&ov13850_out1>;
data-lanes = <1 2>;
};
// mipi_in_dcphy1: endpoint@1 {
// reg = <1>;
// remote-endpoint = <&ov13855_out1>;
// data-lanes = <1 2>;
// };
mipidcphy1_in_ucam2: endpoint@1 {
reg = <1>;
remote-endpoint = <&imx415_out2>;
data-lanes = <1 2 3 4>;
};
};
port@1 {
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;
csidcphy1_out: endpoint@0 {
reg = <0>;
remote-endpoint = <&mipi1_csi2_input>;
};
};
};
};
&i2c2 {
status = "okay";
vm149cp1: vm149c@c {
compatible = "silicon touch,vm149c";
status = "disabled";
reg = <0x0c>;
rockchip,camera-module-index = <1>;
rockchip,camera-module-facing = "front";
};
ov13850_3: ov13850@10 {
compatible = "ovti,ov13850";
status = "disabled";
reg = <0x10>;
clocks = <&cru CLK_MIPI_CAMARAOUT_M4>;
clock-names = "xvclk";
pinctrl-names = "default";
pinctrl-0 = <&mipim0_camera4_clk>;
rockchip,grf = <&sys_grf>;
reset-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>;
pwdn-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
rockchip,camera-module-index = <1>;
rockchip,camera-module-facing = "front";
rockchip,camera-module-name = "CMK-CT0116";
rockchip,camera-module-lens-name = "default";
lens-focus = <&vm149cp1>;
port {
ov13850_out1: endpoint {
remote-endpoint = <&mipi_in_dcphy0>;
data-lanes = <1 2>;
};
};
};
// dw9714: dw9714@c {
// compatible = "dongwoon,dw9714";
// status = "disabled";
// reg = <0x0c>;
// rockchip,camera-module-index = <0>;
// rockchip,vcm-start-current = <10>;
// rockchip,vcm-rated-current = <85>;
// rockchip,vcm-step-mode = <5>;
// rockchip,camera-module-facing = "front";
// };
// ov13855_3: ov13855@36 {
// compatible = "ovti,ov13855";
// status = "disabled";
// reg = <0x36>;
// clocks = <&cru CLK_MIPI_CAMARAOUT_M4>;
// clock-names = "xvclk";
// pinctrl-names = "default";
// pinctrl-0 = <&mipim0_camera4_clk>;
// rockchip,grf = <&sys_grf>;
// reset-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>;
// pwdn-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
// rockchip,camera-module-index = <1>;
// rockchip,camera-module-facing = "front";
// rockchip,camera-module-name = "CMK-OT2016-FV1";
// rockchip,camera-module-lens-name = "default";
// lens-focus = <&dw9714>;
// port {
// ov13855_out1: endpoint {
// remote-endpoint = <&mipi_in_dcphy1>;
// data-lanes = <1 2>;
// };
// };
// };
imx415_3: imx415-3@37 {
compatible = "sony,imx415";
status = "disabled";
reg = <0x37>;
clocks = <&cru CLK_MIPI_CAMARAOUT_M4>;
clock-names = "xvclk";
pinctrl-names = "default";
pinctrl-0 = <&mipim0_camera4_clk>;
power-domains = <&power RK3588_PD_VI>;
rockchip,grf = <&sys_grf>;
reset-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
power-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
// pwdn-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
orangepi,clkout-enabled-index = <0>;
rockchip,camera-module-index = <0>;
rockchip,camera-module-facing = "back";
rockchip,camera-module-name = "CMK-OT2022-PX1";
rockchip,camera-module-lens-name = "IR0147-50IRC-8M-F20";
// rockchip,camera-module-name = "RADXA-CAMERA-4K";
// rockchip,camera-module-lens-name = "DEFAULT";
port {
imx415_out2: endpoint {
remote-endpoint = <&mipidcphy1_in_ucam2>;
data-lanes = <1 2 3 4>;
};
};
};
};
&mipi1_csi2 {
status = "disabled";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
mipi1_csi2_input: endpoint@1 {
reg = <1>;
remote-endpoint = <&csidcphy1_out>;
};
};
port@1 {
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;
mipi1_csi2_output: endpoint@0 {
reg = <0>;
remote-endpoint = <&cif_mipi_in1>;
};
};
};
};
&rkcif_mipi_lvds1 {
status = "disabled";
port {
cif_mipi_in1: endpoint {
remote-endpoint = <&mipi1_csi2_output>;
};
};
};
&rkcif_mipi_lvds1_sditf {
status = "disabled";
port {
mipi1_lvds_sditf: endpoint {
remote-endpoint = <&isp1_in0>;
};
};
};
&rkisp1_vir0 {
status = "disabled";
port {
#address-cells = <1>;
#size-cells = <0>;
isp1_in0: endpoint@0 {
reg = <0>;
remote-endpoint = <&mipi1_lvds_sditf>;
};
};
};
以此类推,修改三个 dtsi
文件:
rk3588-imx415-c*.dts
再增加三个激活的设备树文件,分别对应香橙派上的三个相机接口:
添加的路径为: kernel/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/overlay/rk3588-imx415-c1.dts
。
添加的内容如下:
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&csi2_dphy0_hw>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&csi2_dphy0>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&mipi2_csi2>;
__overlay__ {
status = "okay";
};
};
fragment@3 {
target = <&rkcif_mipi_lvds2>;
__overlay__ {
status = "okay";
};
};
fragment@4 {
target = <&rkcif_mipi_lvds2_sditf>;
__overlay__ {
status = "okay";
};
};
fragment@5 {
target = <&rkisp0_vir1>;
__overlay__ {
status = "okay";
};
};
fragment@6 {
target = <&i2c7>;
__overlay__ {
status = "okay";
imx415-1@37 {
status = "okay";
};
};
};
fragment@7 {
target = <&rkcif>;
__overlay__ {
status = "okay";
};
};
fragment@8 {
target = <&rkcif_mmu>;
__overlay__ {
status = "okay";
};
};
fragment@9 {
target = <&rkisp0>;
__overlay__ {
status = "okay";
};
};
fragment@10 {
target = <&isp0_mmu>;
__overlay__ {
status = "okay";
};
};
};
然后在 kernel/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/overlay/Makefile
目录下面添加编译:
然后使用命令重编kernel,会自动将 dts
文件编译,在对应目录下载这四个文件即可:
rk3588s-orangepi-5b.dts
和三个dtsi
文件在同一目录下。之所以更新
rk3588s-orangepi-5b.dts
,是因为三个dtsi
文件是被其调用的,不会单独生成dtb
。
rk3588s-orangepi-5b.dts
更新到 /boot/dtb/rockchip
:
三个 .dtbo
更新到 /boot/dtb/rockchip/overlay
:
最后在香橙派上直接输入 sudo orangepi-config
,在 System->Hardware
里空格选择对应在对应camera接口位置加载,回车save然后reboot。
测试命令:
gst-launch-1.0 v4l2src device=/dev/video11 ! video/x-raw,format=NV12,width=1920,height=1080, framerate=60/1 ! xvimagesink
iq文件有些问题,颜色有点失真,不过可以正常出图:
香橙派上读取imx415寄存器报错:
找到报错源头,I2C 通信出错:
最终排查,相机电源引脚及I2C未正常配置,配置完成后,即可正常启动。
使用的imx415芯片两个 SLAMODE
引脚均拉高,因此I2C从机地址为 0x37
,参照下图:
同时,本电路中复位脚需配置 reset-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
,应该注意。
最终成功dmesg信息如下:
搜索的可能原因如下 1:
后来发现,在camera1接口可以稳定出图,而2、3接口存在相关问题。考虑cam2、cam3使用的是时钟4:
而CAM1使用的是时钟3:
可能是相关时钟源导致的,等待进一步验证相关问题。
camera调试:RK3588 apk打开不出图如何排查? ↩︎