rk3288-android9-ov13850

说明:最近调试了下rk3288-android9下的ov13850,碰到了一些坑,现整理记录下,避免以后继续踩坑。

一. 代码路径

1.camera代码路径

2.hal3_camera层代码路径

3.camera_engine代码路径

二:修改内容

1. hal3用到的camera3_profile.xml

a.SDK 下文件路径
    sdk/hardware/rockchip/camera/etc/camera/camera3_profiles_rk3288.xml
b.目标板路径:
vendor/etc/camera/camera3_profiles.xml
c. 编译时复制路径:
hardware/rockchip/camera/etc/camera_etc.mk

2. 3A库相关文件

3A库为瑞芯微提供so文件,但是不提供源码。需要编译拷贝到项目板
a. 编译配置路径:
hardware/rockchip/camera_engine_rkisp/interface/Android.mk
b. 复制文件路径:
device/rockchip/common/device.mk
# CAMERA
ifeq ($(BOARD_CAMERA_SUPPORT),true)
PRODUCT_PACKAGES += \\
    librkisp_aec \\
    librkisp_awb \\
    librkisp_af 
c. 目标板路径:
vendor/lib/rkisp/ae
vendor/lib/rkisp/awb
vendor/lib/rkisp/af

3. 3A库的tunning文件路径

a. tunning文件在SDK的路径
hardware/rockchip/camera_engine_rkisp/iqfiles/ov13850_CMK-CT0116_Largan-50013A1.xml 
b. 对应摄像头的命名方式
<sensor_name>_<module_name>_<lens_name>.xml
c. 目标板路径:
vendor/etc/camera/rkisp1/

4. 内核修改

&i2c3 {
    
    status = "okay";
    clock-frequency = <400000>;

        vm149c: vm149c@0c {
                compatible = "silicon touch,vm149c";
                status = "okay";
                reg = <0x0c>;
        rockchip,vcm-start-current = <20>; // 马达的启动电流
        rockchip,vcm-rated-current = <80>; // 马达的额定电流
        rockchip,vcm-step-mode = <13>; // 马达驱动 ic 的电流输出模式
                rockchip,camera-module-index = <0>;
                rockchip,camera-module-facing = "back";
        };

    ov13850: ov13850@10 {
        compatible = "ovti,ov13850"; // 需要与驱动中的匹配字符串一致
        status = "okay";
        reg = <0x10>; // sensor I2C 设备地址
        clocks = <&cru SCLK_VIP_OUT>; // sensor clickin 配置
        clock-names = "xvclk";
                avdd-supply = <&dvp_pwr>;
                dovdd-supply = <&dvp_pwr>;
                dvdd-supply = <&dvp_pwr>;
//      reset-gpios = <&gpio2i RK_PB5 GPIO_ACTIVE_HIGH>;
        // reset 管脚分配及有效电平
        pwdn-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>;
        pinctrl-names = "default";
        pinctrl-0 = <&isp_mipi>;
        // power 管脚分配及有效电平
//      pinctrl-names = "rockchip,camera_default";
//      pinctrl-0 = <&cif_clkout>; // pinctl 设置
        rockchip,camera-module-index = <0>; // 模组编号,该编号不要重复
        rockchip,camera-module-facing = "back"; // 模组朝向,有"back"和"front"
        rockchip,camera-module-name = "CMK-CT0116"; // 模组名
        rockchip,camera-module-lens-name = "Largan-50013A1"; // lens 名
        // 模组名和 lens 名被用来和 IQ xml 文件做匹配
        lens-focus = <&vm149c>; // vcm 驱动设置,支持 AF 时需要有这个设置
        port {
            ucam_out0: endpoint {
            remote-endpoint = <&mipi_in_ucam0>;
            // mipi dphy 端的 port 名
            data-lanes = <1 2>;
            // mipi lane 数, 1lane 为 <1>, 4lane 为 <1 2 3 4>
            };
        };
    };

};
&mipi_phy_rx0 {
    status = "okay";
    ports {
        #address-cells = <1>;
        #size-cells = <0>;
        port@0 {
            reg = <0>;
            #address-cells = <1>;
            #size-cells = <0>;
            mipi_in_ucam0: endpoint@1 {
                reg = <1>;
                remote-endpoint = <&ucam_out0>;
                // sensor 端的 port 名
                data-lanes = <1 2>;
                // mipi lane 数, 1lane 为 <1>, 4lane 为 <1 2 3 4>
            };
        };
        port@1 {
            reg = <1>;
            #address-cells = <1>;
            #size-cells = <0>;
            dphy_rx0_out: endpoint@0 {
                reg = <0>;
                remote-endpoint = <&isp0_mipi_in>;
                // isp 端的 port 名
            };
        };
    };
};

&rkisp1 {
    status = "okay";
    port {
        #address-cells = <1>;
        #size-cells = <0>;
        isp0_mipi_in: endpoint@0 {
            reg = <0>;
            remote-endpoint = <&dphy_rx0_out>;
            // mipi dphy 端的 port 名
        };
    };
};
&isp_mmu {
    status = "okay"; // isp 驱动使用了 iommu,所以 isp iommu 也需要打开
};
&isp {  //rkisp和isp 复用,只能使用一个,rkisp为hal3,isp为hal1
    status = "disabled";
};
*rockchip_defconfig配置*

CONFIG_VIDEO_OV13850=y
CONFIG_VIDEO_VM149C=y

三. 调试工具

v4l2-ctl.7z

media-ctl.zip

四. 调试方法

1.判断isp驱动加载状态

grep '' /sys/class/video4linux/video*/name
/sys/class/video4linux/video3/name:rkisp1_selfpath
/sys/class/video4linux/video4/name:rkisp1_mainpath
/sys/class/video4linux/video5/name:rkisp1-statistics
/sys/class/video4linux/video6/name:rkisp1-input-params

2.判断camera驱动是否加载成功

dmesg | grep Async
[ 0.682982] rkisp1: Async subdev notifier completed

3. 3A库调试开关

setprop persist.vendor.rkisp.log 0xffffffff

4. 解析IQ文件出错或未找到IQ文件的logcat

"failed to get iq file name"
"load tunning file failed"

5. 确认3A是否有运行

6. 设置mipi摄像头前置

1.修改dts
rockchip,camera-module-facing = "front";
2.修改camera3_profiles.xml
 <!-- Lens -->
 <lens.facing value="FRONT"/>
以下是一份针对RK3288-EVB-Android SDK的DTS文件修改示例,可以实现SD卡启动: ``` /dts-v1/; /plugin/; / { model = "Rockchip RK3288-EVB board"; compatible = "rockchip,rk3288-evb"; memory@60000000 { device_type = "memory"; reg = <0x60000000 0x40000000>; }; chosen { bootargs = "console=ttyS2,115200n8 root=/dev/mmcblk1p2 rw rootwait earlyprintk"; stdout-path = &uart2; }; uart2: serial@11004000 { compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart"; reg = <0x11004000 0x1000>; interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; clocks = <&uart2_clk>; clock-names = "uartclk"; status = "okay"; }; sdhci@11014000 { compatible = "rockchip,rk3288-dw-mshc"; reg = <0x11014000 0x1000>; interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru SCLK_SDMMC>, <&cru PCLK_SDMMC>; clock-names = "sdmmc", "apb_pclk"; pinctrl-names = "default"; pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4 &sdmmc_bus8 &sdmmc_cd_n>; status = "okay"; mmc-slot@0 { reg = <0>; bus-width = <8>; cd-gpios = <&gpio7 3 GPIO_ACTIVE_LOW>; non-removable; status = "okay"; }; }; &dpu { status = "okay"; }; &lcdc { status = "okay"; }; &backlight { status = "okay"; }; &act8846_reg { status = "okay"; }; &i2c1 { status = "okay"; act8846: act8846@5b { compatible = "active-semi,act8846"; reg = <0x5b>; gpio-controller; #gpio-cells = <2>; interrupt-parent = <&gpio2>; interrupts = <6 IRQ_TYPE_LEVEL_LOW>; status = "okay"; }; }; &mmc { status = "okay"; }; &mmc1 { status = "okay"; }; &mmc2 { status = "okay"; }; &mmc3 { status = "okay"; }; &mmc4 { status = "okay"; }; &sdmmc_clk { rockchip,pins = <RK_GPIO3 8 RK_FUNC_2 &pcfg_pull_none>; }; &sdmmc_cmd { rockchip,pins = <RK_GPIO3 9 RK_FUNC_2 &pcfg_pull_none>; }; &sdmmc_bus4 { rockchip,pins = <RK_GPIO3 10 RK_FUNC_2 &pcfg_pull_none>; }; &sdmmc_bus8 { rockchip,pins = <RK_GPIO3 11 RK_FUNC_2 &pcfg_pull_none>; }; &sdmmc_cd_n { rockchip,pins = <RK_GPIO7 3 RK_FUNC_GPIO &pcfg_pull_up>; }; }; ``` 此外,你还需要在编译内核时加入SD卡启动相关的配置选项。具体方法可以参考RK3288-Android SDK的文档。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值