VEYE CS Camera for Jetson TX2/zh

From wiki_veye
Jump to navigation Jump to search

English

如何在英伟达Jetsno Nano,TX2,AGX Xavier和Xavier NX平台使用VEYE系列和CS系列摄像头模组

概述

本文讲述怎样将VEYE系列和CS系列模组接入到英伟达公司的Jetson Nano,Jetson TX2和AGX Xavier开发板,Xavier NX Devkit以及我们兼容的其他TX2主板上。采用的软件版本为

  • Jetpack4.2.2,L4T版本r32.2.1
  • Jetpack4.3,L4T版本r32.3.1
  • Jetpack4.4,L4T版本r32.4.3

我们提供了编译好的固件和源代码两种方式来方便用户的使用。

VEYE-MIPI-327/CS-MIPI-IMX307是内置ISP的摄像头模组,输出为MIPI-CSI2接口UYVY流模式。对于图像效果参数,我们并没有采用V4L2接口实现,而是采用了DRA(Directly Register Access)模式,我们提供了一组Shell脚本直接控制摄像头模组。

硬件准备及安装

我们设计了专用的转接板,支持6路摄像头,兼容TX2 Devkit和Xavier。

6cam interposer board connected with 6 cameras


英伟达TX2 Developer Kit

TX2 Devkit 6 cameras connection


英伟达AGX Xavier

转接板是兼容TX2转接板的,连接方式如图:

Connect VEYE cameras to AGX Xavier(绿色版本托板为临时版本,正式版本是黑色的)

英伟达Nano 和 Xavier NX Devkit

Xavier NX 的接口是兼容树莓派和Jetson Nano的。 连接方式如图:

Xavier NX connection with VEYE-MIPI-327
Xavier NX connection with VEYE-MIPI-327
Xavier NX connection with CS-MIPI-IMX307
Xavier NX connection with CS-MIPI-IMX307(3.3V供电)
Jetson Nano A02 与VEYE模组连接
Jetson Nano A02 与VEYE模组连接


更新Jetson Nano, Jetson TX2,AGX Xavier和Xavier NX系统

概述

本章节描述怎样更新Jetson系统以支持我们的摄像头模组。要支持我们的摄像头模组,需要更新Jetson系统的L4T(Linux for Tegra)的两个部分,Image和DTB。

Image部分,我们增加了摄像头驱动,DTB部分则指明了使用的摄像头型号。一般情况下,只需使用我们已编译好的Image和DTB,非必要情况下,无需根据代码进行编译。

特别的,对于Jetson Nano 和 Xavier NX,我们提供了TF卡的烧写镜像。

整体烧写Jetson Nano 和 Xavier NX Devkit

此方法不再推荐,因为这种模式下,在某些情况下,DTB分区会恢复成默认值。推荐采用使用预编译好Image和DTB这种方式来进行驱动升级。

客户可选择直接使用我们编译好的镜像进行系统更新,以支持我司摄像头模组。

  • 镜像下载路径:

baiduyun链接:https://pan.baidu.com/s/1sWrcfEOivjuQ7T7P5bVcng

google driver:https://drive.google.com/drive/folders/1KHSMTdyw-ZczR1yJPj-5y9eIv7izbgt3?usp=sharing

下载后请先解压后烧写。

如百度云盘下载过慢,可以单独联系我公司客服xumm@csoneplus.com索取。

  • 烧写方法

参考官方链接

BSP包介绍:

路径

https://github.com/veyeimaging/nvidia_jetson_veye_bsp

bsp包包括以下主要内容:
  • 预编译好的linux kernel:Image
  • 预编译好的不同平台下的dtb
  • driver源码
  • dts源码
  • i2c通信工具集

Jetson Nano和Xavier NX无需HOST PC升级方法

查看当前L4T版本

首先查看当前L4T版本,尽量使用同一版本进行替换。

cat /etc/nv_tegra_release

如显示:

# R32 (release), REVISION: 4.3......

则表示当前版本为32.4.3。

下载bsp包到Jetson板子

在Jetson Nano或者Xavier NX上面,执行:

git clone https://github.com/veyeimaging/nvidia_jetson_veye_bsp.git

升级Image

首先在bsp包目录下,找到对应版本的Image压缩包,解压后执行:

sudo cp <path to your Image dir>/Image /boot/Image -f

升级dtb

在bsp包目录下,找到您对应的摄像头模组型号和L4T版本号的dtb文件。

sudo cp <path to your dtb dir>/<DTB file name> /boot/ -f

然后,编辑 /boot/extlinux/extlinux.conf文件,增加如下一行。

FDT /boot/<DTB file name>

通过HOST PC升级方法

HOST开发环境准备
  • 编译工具链

请参考这个链接安装编译工具链。

  • L4T源码和Rootfs

可以通过SDK Manager或者直接下载两种方式来获得源码。具体参考官方文档,此处不再赘述。

使用SDK Manager时同步代码采用如下指令:

- Jetpack4.2.2

./source_sync.sh -t tegra-l4t-r32.2.1

- Jetpack4.3

./source_sync.sh -t tegra-l4t-r32.3.1

- Jetpack4.4

./source_sync.sh -t tegra-l4t-r32.4.3

  • 配置开发环境

以下步骤假设SDK安装目录为<TOPDIR>,源代码在$L4T_DIR/sources目录。

- Nano@Jetpack4.2.2

export TOP_DIR=<absolute path to top dir;in my case is /home/xumm/nvidia/nvidia_sdk/JetPack_4.2.2_Linux_GA_P3448/>

- Nano@Jetpack4.3

export TOP_DIR=<absolute path to top dir;in my case is /home/xumm/nvidia/nvidia_sdk/JetPack_4.3_Linux_JETSON_NANO_DEVKIT/>

- Nano@Jetpack4.4

export TOP_DIR=<absolute path to top dir;in my case is /home/xumm/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/>

- TX2@Jetpack4.2.2

export TOP_DIR=/home/xumm/nvidia/nvidia_sdk/JetPack_4.2.2_Linux_GA_P3310/

- TX2@Jetpack4.3

export TOP_DIR=/home/xumm/nvidia/nvidia_sdk/JetPack_4.3_Linux_P3310/

- TX2@Jetpack4.4

export TOP_DIR=/home/xumm/nvidia/JetPack_4.4_Linux_JETSON_TX2/

- AGX XavierJetpack4.2.2

export TOP_DIR=/home/xumm/nvidia/nvidia_sdk/JetPack_4.2.2_Linux_GA_P2888/

- AGX XavierJetpack4.3

export TOP_DIR=/home/xumm/nvidia/nvidia_sdk/JetPack_4.3_Linux_P2888/

- AGX XavierJetpack4.4

export TOP_DIR=/home/xumm/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/

- Xavier NX Jetpack4.4

export TOP_DIR=/home/xumm/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT

- 通用部分

export L4T_DIR=$TOP_DIR/Linux_for_Tegra

export LOCALVERSION=-tegra

export LDK_ROOTFS_DIR=$TOP_DIR/Linux_for_Tegra/rootfs

export ARCH=arm64

export CROSS_COMPILE=aarch64-linux-gnu-

export CROSS32CC=arm-linux-gnueabihf-gcc

export TEGRA_KERNEL_OUT=$L4T_DIR/sources/kernel/out_kernel

export KERNEL_PATH=$L4T_DIR/sources/kernel/out_kernel

export NVIDIA_PATH=$L4T_DIR/sources/kernel/nvidia

export NANO_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t210/

export TX2_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t18x

export XAVIER_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t19x

cd $L4T_DIR/sources/kernel/kernel-4.9/

  • 生成默认版本烧写镜像,烧写默认镜像到板子,准备好L4T环境

cd $L4T_DIR

sudo ./apply_binaries.sh  

进入recovery mode并烧写标准版本镜像

- Nano

sudo ./flash.sh jetson--qspi-sd mmcblk0p1

- TX2

sudo ./flash.sh jetson-tx2 mmcblk0p1

- AGX Xavier

sudo ./flash.sh jetson-xavier mmcblk0p1

- Xavier NX Devkit

sudo ./flash.sh jetson-xavier-nx-devkit mmcblk0p1

下载我们的bsp包

cd $L4T_DIR

git clone https://github.com/veyeimaging/nvidia_jetson_veye_bsp.git

export RELEASE_PACK_DIR=$L4T_DIR/nvidia_jetson_veye_bsp

升级Image和DTB

prebuilt Image on github:https://github.com/veyeimaging/nvidia_jetson_veye_bsp/tree/master/kernel_image

  • 升级Image文件

无论是使用预编译好的程序还是使用自行编译出的Image:

- Nano 和 TX2

把新的Image拷贝的Nano和TX2的/boot/目录下。

在Jetson TX2板子上执行

sudo cp <path to your Image dir>/Image /boot/Image -f

- AGX Xavier 和Xavier NX

需要使用签名后的文件,把新的Image和Image.sig拷贝的XAVIER的/boot/目录下。

sudo cp <path to your Image dir>/Image /boot/Image -f

sudo cp <path to your Image dir>/Image.sig /boot/Image.sig -f

在Host PC执行

cd $L4T_DIR

sudo ./flash.sh -k kernel jetson-xavier mmcblk0p1

- Xavier NX

在Host PC执行

cd $L4T_DIR

sudo ./flash.sh -k kernel jetson-xavier-nx-devkit mmcblk0p1

  • 烧写DTS分区,进入烧写模式,在Host PC执行

cp <path to your dtb dir>/dtbfilename $L4T_DIR/kernel/dtb/ -f

cd $L4T_DIR

- Nano

sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1

- TX2

sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1

- AGX Xavier

sudo ./flash.sh -r -k kernel-dtb jetson-xavier mmcblk0p1

- Xavier NX

sudo ./flash.sh -r -k kernel-dtb jetson-xavier-nx-devkit mmcblk0p1

烧写完成后,断电重启。

Image和DTB更新成功了吗?

完成Image和DTB的更新后,可以使用以下步骤检查操作是否成功。

对于Image

ls /sys/bus/i2c/drivers/

应当有 veye327 csx307 cssc132 目录的存在

对于DTB

DTB在不同的平台和不同的摄像头模组都会有所不同。

- Nano A02

ls /proc/device-tree/host1x/i2c@546c0000/

- Nano B01

ls /proc/device-tree/cam_i2cmux/i2c@*

- TX2 Devkit

ls /proc/device-tree/i2c@3180000/tca9548@70/i2c@*

- AGX Xavier

ls /proc/device-tree/i2c@3180000/tca9548@70/i2c@*

- Xavier NX

ls /proc/device-tree/cam_i2cmux/i2c@*

应当可以发现摄像头型号。

使用源码进行编译

编译kernel
  • patch代码

cp $RELEASE_PACK_DIR/drivers_source/cam_drv_src/* $NVIDIA_PATH/drivers/media/i2c/

- r32.2.1

cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.2.1 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig

- r32.3.1

cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.3.1 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig

- r32.4.2

cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.4.2 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig

- r32.4.3

cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.4.3 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig

  • 编译

cd $L4T_DIR/sources/kernel/kernel-4.9/

make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_veyecam_defconfig

make ARCH=arm64 O=$TEGRA_KERNEL_OUT Image -j4

编译完成的Image文件在 $TEGRA_KERNEL_OUT/arch/arm64/boot/Image,可以用于整体烧写,也可以用于动态升级。

以下用于整体烧写

sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $L4T_DIR/kernel/ -f

  • 对于xavier,进行签名

cd $L4T_DIR

./l4t_sign_image.sh --file kernel/Image --chip 0x19

编译DTS
  • patch代码

- Nano@Jetpack4.2.2

cp $RELEASE_PACK_DIR/Nano/JetPack_4.2.2_Linux_GA_P3448/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/Nano/JetPack_4.2.2_Linux_GA_P3448/dts\ dtb/VEYE-MIPI-327/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/Nano/JetPack_4.2.2_Linux_GA_P3448/dts\ dtb/CS-MIPI-IMX307/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

- Nano@Jetpack4.3

cp $RELEASE_PACK_DIR/Nano/JetPack_4.3_Linux_P3448/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/Nano/JetPack_4.3_Linux_P3448/dts\ dtb/VEYE-MIPI-327/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/Nano/JetPack_4.3_Linux_P3448/dts\ dtb/CS-MIPI-IMX307/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

- Nano@Jetpack4.4

cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/VEYE-MIPI-327/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/CS-MIPI-IMX307/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

对于CS-MIPI-SC132

cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/CS-MIPI-SC132/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

- TX2@Jetpack4.2.2

cp $RELEASE_PACK_DIR/TX2/JetPack_4.2.2_Linux_GA_P3310/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/TX2/JetPack_4.2.2_Linux_GA_P3310/dts\ dtb/CS-MIPI-IMX307/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/TX2/JetPack_4.2.2_Linux_GA_P3310/dts\ dtb/VEYE-MIPI-327/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

- TX2@Jetpack4.3

cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/CS-MIPI-IMX307/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

对于CS-MIPI-SC132

cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/CS-MIPI-SC132/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/VEYE-MIPI-327/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

- TX2@Jetpack4.4

cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/CS-MIPI-IMX307/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

对于CS-MIPI-SC132

cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/CS-MIPI-SC132/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/VEYE-MIPI-327/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

- AGX Xavier@Jetpack4.2.2

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.2.2_Linux_GA_P2888/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.2.2_Linux_GA_P2888/dts\ dtb/CS-MIPI-IMX307/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.2.2_Linux_GA_P2888/dts\ dtb/VEYE-MIPI-327/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

- AGX Xavier@Jetpack4.3

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/CS-MIPI-IMX307/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

对于CS-MIPI-SC132

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/CS-MIPI-SC132/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/VEYE-MIPI-327/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

- AGX Xavier@Jetpack4.4

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/CS-MIPI-IMX307/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

对于CS-MIPI-SC132

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/CS-MIPI-SC132/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/VEYE-MIPI-327/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

- Xavier NX@Jetpack4.4

cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/

对于CS-MIPI-IMX307

cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/CS-MIPI-IMX307/tegra194-p3509-0000-a00.dtsi $XAVIER_DTS_PATH/jakku/kernel-dts/common/

对于CS-MIPI-SC132

cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/CS-MIPI-SC132/tegra194-p3509-0000-a00.dtsi $XAVIER_DTS_PATH/jakku/kernel-dts/common/

对于VEYE-MIPI-327

cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/VEYE-MIPI-327/tegra194-p3509-0000-a00.dtsi $XAVIER_DTS_PATH/jakku/kernel-dts/common/

  • 编译

cd $L4T_DIR/sources/kernel/kernel-4.9/

make ARCH=arm64 O=$TEGRA_KERNEL_OUT dtbs

- Nano

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-a02.dtb $L4T_DIR/kernel/dtb/

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-b00.dtb $L4T_DIR/kernel/dtb/

- TX2

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb $L4T_DIR/kernel/dtb/

- AGX XAVIER

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb $L4T_DIR/kernel/dtb/

- XAVIER NX

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p3668-all-p3509-0000.dtb $L4T_DIR/kernel/dtb/

kernel和DTS编译完成后,可以按照上面的步骤升级Image和DTB。

应用和测试

系统状态检测

完成系统安装后,在Jetson TX2板端执行以下命令来检测是否正确连接摄像头。

  • VEYE-MIPI-327型号

dmesg | grep veye327  

应当有类似如下提示:

Detected VEYE327 sensor

subdev veye327 X-003b bound

此外,检查/dev/videoX设备节点,应当是存在的。

  • CS-MIPI-IMX307型号

dmesg | grep x307  

应当有类似如下提示:

Detected CS307 sensor

subdev csx307 X-003b bound

此外,检查/dev/videoX设备节点,应当是存在的。

  • CS-MIPI-SC132型号

dmesg | grep cssc132  

应当有类似如下提示:

subdev cssc132 X-003b bound

此外,检查/dev/videoX设备节点,应当是存在的。

视频流软件包和测试

我们的摄像头模组,在TX2系统中映射为/dev/videoX设备节点。X值是按照detect的逻辑顺序[0-5]递增的。举例说,如果只接入一个摄像头,则X为0。如果接入5个,则X体现为[0-4]。

gstreamer中,v4l2src可以通过指明device=/dev/videoX来访问不同的摄像头。

Gstreamer Usage
  • 视频预览1080p HD(硬件加速)

gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080" ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420" ! nvoverlaysink sync=false

  • 视频预览720p@60 HD(模组支持此分辨率时,硬件加速)

gst-launch-1.0 v4l2src ! "video/x-raw,format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60/1" ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420" ! nvoverlaysink sync=false

  • 视频预览1280*1080@45fpsHD(硬件加速)

gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1280, height=(int)1080,framerate=(fraction)45/1" ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420" ! nvoverlaysink sync=false

  • 视频预览640*480@130fps(模组支持此分辨率时,硬件加速)

gst-launch-1.0 v4l2src ! "video/x-raw,format=(string)UYVY, width=(int)640, height=(int)480, framerate=(fraction)130/1" ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420" ! nvoverlaysink sync=false

  • 并列预览两路视频 1080p HD(硬件加速)

WIDTH=960

HEIGHT=540

CAPS="video/x-raw,format=(string)UYVY, width=1920, height=1080"

gst-launch-1.0 nvcompositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=$WIDTH sink_0::height=$HEIGHT sink_1::xpos=$WIDTH sink_1::ypos=0 sink_1::width=$WIDTH sink_1::height=$HEIGHT ! nvoverlaysink v4l2src device=/dev/video0 ! $CAPS ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420"! comp. v4l2src device=/dev/video1 ! $CAPS ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420"! comp.

  • Gstreamer 嵌入到 OpenCV

I think maybe OpenCV do not support I420 data format input,so you should convert it to BGR format.

gst-launch-1.0 v4l2src ! video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080 ! nvvidconv ! video/x-raw(memory:NVMM), format=(string)I420 ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink

  • 视频录像1080p HD(硬件加速)

gst-launch-1.0 v4l2src num-buffers=300 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080" ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420" ! omxh264enc qp-range=20,20:20,20:-1,-1 ! matroskamux ! queue ! filesink location=videoname.mkv

  • 录像回放(硬件加速)

gst-launch-1.0 filesrc location=videoname.mkv ! matroskademux ! h264parse ! omxh264dec ! nvoverlaysink

  • 抓拍图片

gst-launch-1.0 v4l2src num-buffers=1 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080" ! jpegenc ! filesink location=jpgname.jpg

视频控制软件包的使用

  • i2c bus说明:

在TX2和AGX-Xavier平台,ADP-N1共6个MIPI接口,对应的i2c地址为[30-35]。

在Xavier NX平台,i2c地址为9和10。

在Xavier Nano A02平台,i2c地址为6。

在Xavier Nano B01平台,i2c地址为7和8。

dmesg 显示的X部分一致。

subdev veye327 X-003b bound

subdev csimx307 X-003b bound

subdev cssc132 X-003b bound

执行i2c控制脚本时,需使用-b选项来指明控制的对应摄像头。

  • VEYE-MIPI-327

具体使用说明请见:VEYE-MIPI-327 I2C脚本使用说明

  • CS-MIPI-IMX307和CS-MIPI-SC132

具体使用说明请见:CS-MIPI-X I2C脚本使用说明

瑞泰RTSO-9001的补充说明

硬件连接方法

CS-MIPI-IMX307 与瑞泰RTSO-9001(TX2)


与瑞泰RTSO-9001配套,需使用树莓派相机扩展板RTST-RPI转接板。

备注:当前版本的RTSO-9001的MIPI CSI-2接口供电能力不足以支撑我们摄像头的功率需求,需要额外5V供电给摄像头。上图中并未提现。

软件的补充说明

  • 针对瑞泰RTSO-9001,对应的目录为:

nvidia_jetson_veye_bsp\TX2\JetPack_4.2.2_Linux_RTSO-9001

  • 受与瑞泰公司协议限制,我方不发布源代码
  • 我方资料已提交瑞泰公司,建议客户与瑞泰联系获取完善版本的支持镜像

参考资料

Jetson start up: https://developer.nvidia.com/embedded/learn/getting-started-jetson

Jetson Download Center: https://developer.nvidia.com/embedded/downloads

Xavier NX: https://developer.nvidia.com/embedded/learn/get-started-jetson-xavier-nx-devkit

TX2 development kit: https://developer.nvidia.com/embedded/jetson-tx2-developer-kit

SDK Manager: https://docs.nvidia.com/sdk-manager/index.html

L4T Doc: https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3242/index.htm

TX2 user guide: link

北京瑞泰新时代公司网址:http://www.realtimes.cn/