RK3566 linux调试双目摄像头 同时开启

基于RK3566做人脸识别,选用了一款双目摄像头,RGB+IR,RGB Sensor为GC2093,IR Sensor为GC2053。MIPI CSI使用split mode,可以同时读取两个Sensor的图像。

注意事项:一些低版本的SDK无法启用双目摄像头,刚开始使用的内核版本为4.19.193一直无法启用,后来换为内核版本为4.19.232 sdk才行。

一、硬件连接

器件I2C总线及地址:

GC2093:I2C2---0x7e(7bit address);

GC2053:I2C2---0x37(7bit address);

CSI:

GC2093--->csi2_dphy2(MIPI_CSI_RX_D2-3&MIPI_CSI_RX_CLK1);

GC2053--->csi2_dphy1(MIPI_CSI_RX_D0-1&MIPI_CSI_RX_CLK0);

CLK:

GC2093:CLK_OUT1(GPIO4_C0------CIF_CLKOUT);

GC2053:CLK_OUT0(GPIO4_A7-------CAM_CLKOUT0);

GPIO:

GC2093 reset-gpios---GPIO0_C0;

GC2093 pwdn-gpios---GPIO0_C1;

GC2053 reset-gpios---GPIO0_C4;

GC2053 pwdn-gpios---GPIO0_C3;

二、内核使能RKCIF驱动

内核中需要选中Rockchip Camera Interface driver

Device Drivers --->

Multimedia support --->

V4L platform devices --->

<*> Rockchip Camera Interface driver

rockchip camera sensor interface work mode (interface works in pingpong mode) --->

rockchip rkcif device dummy buffer choice (rkcif use dummy buffer) --->

注意:很多教程都没讲到这一点,可能所用sdk默认使能了RKCIF驱动。因为我所用的sdk默认关闭了此驱动,导致我花了很多时间查找原因。

三、调试

1、查看启动日志,是否检测到了摄像头并且注册了
[root@RK356X:]# dmesg | grep gc20
[    1.223226] gc2053 2-0037: driver version: 00.01.01
[    1.223320] gc2053 2-0037: Failed to get power-gpios
[    1.223342] gc2053 2-0037: Looking up dovdd-supply from device tree
[    1.223352] gc2053 2-0037: Looking up dovdd-supply property in node /i2c@fe5b0000/gc2053@37 failed
[    1.223380] gc2053 2-0037: 2-0037 supply dovdd not found, using dummy regulator
[    1.223465] gc2053 2-0037: Linked as a consumer to regulator.0
[    1.223482] gc2053 2-0037: Looking up avdd-supply from device tree
[    1.223492] gc2053 2-0037: Looking up avdd-supply property in node /i2c@fe5b0000/gc2053@37 failed
[    1.223507] gc2053 2-0037: 2-0037 supply avdd not found, using dummy regulator
[    1.223557] gc2053 2-0037: Looking up dvdd-supply from device tree
[    1.223565] gc2053 2-0037: Looking up dvdd-supply property in node /i2c@fe5b0000/gc2053@37 failed
[    1.223577] gc2053 2-0037: 2-0037 supply dvdd not found, using dummy regulator
[    1.223631] gc2053 2-0037: lane_num(2)  pixel_rate(118800000)
[    1.231487] gc2053 2-0037: Detected GC2053 sensor
[    1.231552] rockchip-csi2-dphy csi2-dphy1: dphy1 matches m00_f_gc2053 2-0037:bus type 4
[    1.232893] gc2093 2-007e: driver version: 00.01.02
[    1.233031] gc2093 2-007e: Looking up dovdd-supply from device tree
[    1.233042] gc2093 2-007e: Looking up dovdd-supply property in node /i2c@fe5b0000/gc2093@7e failed
[    1.233085] gc2093 2-007e: 2-007e supply dovdd not found, using dummy regulator
[    1.233202] gc2093 2-007e: Linked as a consumer to regulator.0
[    1.233223] gc2093 2-007e: Looking up avdd-supply from device tree
[    1.233233] gc2093 2-007e: Looking up avdd-supply property in node /i2c@fe5b0000/gc2093@7e failed
[    1.233250] gc2093 2-007e: 2-007e supply avdd not found, using dummy regulator
[    1.233330] gc2093 2-007e: Looking up dvdd-supply from device tree
[    1.233343] gc2093 2-007e: Looking up dvdd-supply property in node /i2c@fe5b0000/gc2093@7e failed
[    1.233359] gc2093 2-007e: 2-007e supply dvdd not found, using dummy regulator
[    1.241645] gc2093 2-007e: Detected GC2093 sensor
[    1.241707] rockchip-csi2-dphy csi2-dphy2: dphy2 matches m01_b_gc2093 2-007e:bus type 4

可知检测到了GC2053和GC2093两个摄像头, 并且都注册成功了。

2、查看内核为摄像头在目录/sys/class/video4linux下分配设备信息描述文件
[root@RK356X:/]# grep "" /sys/class/video4linux/v*/name | grep mainpath
/sys/class/video4linux/video14/name:rkisp_mainpath
/sys/class/video4linux/video5/name:rkisp_mainpath

在上层可以用video5和video14打开两个摄像头。

camera_rkisp_test2.sh

#!/bin/bash
#export GST_DEBUG=*:5
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gstreamer-1.0

gst-launch-1.0 v4l2src device=/dev/video14 ! video/x-raw,format=NV12,width=640,height=480, framerate=30/1 ! waylandsink &
gst-launch-1.0 v4l2src device=/dev/video5 ! video/x-raw,format=NV12,width=640,height=480, framerate=30/1 ! waylandsink &

执行脚本即可看到两个sensor的画面,不过有一个会被遮挡。

相关推荐
远游客071340 分钟前
centos stream 8下载安装遇到的坑
linux·服务器·centos
马甲是掉不了一点的<.<41 分钟前
本地电脑使用命令行上传文件至远程服务器
linux·scp·cmd·远程文件上传
jingyu飞鸟42 分钟前
centos-stream9系统安装docker
linux·docker·centos
超爱吃士力架1 小时前
邀请逻辑
java·linux·后端
cominglately4 小时前
centos单机部署seata
linux·运维·centos
魏 无羡4 小时前
linux CentOS系统上卸载docker
linux·kubernetes·centos
CircleMouse4 小时前
Centos7, 使用yum工具,出现 Could not resolve host: mirrorlist.centos.org
linux·运维·服务器·centos
木子Linux5 小时前
【Linux打怪升级记 | 问题01】安装Linux系统忘记设置时区怎么办?3个方法教你回到东八区
linux·运维·服务器·centos·云计算
mit6.8245 小时前
Ubuntu 系统下性能剖析工具: perf
linux·运维·ubuntu
鹏大师运维5 小时前
聊聊开源的虚拟化平台--PVE
linux·开源·虚拟化·虚拟机·pve·存储·nfs