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的画面,不过有一个会被遮挡。

相关推荐
传而习乎10 分钟前
Linux:CentOS 7 解压 7zip 压缩的文件
linux·运维·centos
我们的五年19 分钟前
【Linux课程学习】:进程程序替换,execl,execv,execlp,execvp,execve,execle,execvpe函数
linux·c++·学习
IT果果日记41 分钟前
ubuntu 安装 conda
linux·ubuntu·conda
Python私教43 分钟前
ubuntu搭建k8s环境详细教程
linux·ubuntu·kubernetes
羑悻的小杀马特1 小时前
环境变量简介
linux
小陈phd1 小时前
Vscode LinuxC++环境配置
linux·c++·vscode
是阿建吖!2 小时前
【Linux】进程状态
linux·运维
明明跟你说过2 小时前
Linux中的【tcpdump】:深入介绍与实战使用
linux·运维·测试工具·tcpdump
Komorebi.py3 小时前
【Linux】-学习笔记05
linux·笔记·学习
Mr_Xuhhh3 小时前
重生之我在学环境变量
linux·运维·服务器·前端·chrome·算法