技术专栏
Jetson Xavier平台 MIPI接口采集FPGA 图像视频 (1)驱动移植
1. 前言
这里需要通过Xilinx FGPA将一路CSI视频通过MIPI接口传输到xavier平台
硬件平台: Jetson AGX Xavier
软件版本: L4T 32.4.4
视频: 1920 x 1080, 30fps, YUV444
2. 硬件检验
使用官方自带的ov5693相机模块,出图正常;
说明硬件接收平台是没问题的
3. 根据官方自带模块移植
(1)按照官方的imx185的驱动进行移植修改
按照这个驱动进行修改,无法生成video0设备,I2C检测也异常
(2)按照官方的ov5693的驱动进行移植修改
可以出现设备
具体修改如下
4. 移植如下
(1)修改 tegra194-camera-e3326-a00.dtsi.
这里只使用了一个模式 1920*1080
/ {
host1x {
vi@15c10000 {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
e3326_vi_in0: endpoint {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&e3326_csi_out0>;
};
};
};
};
nvcsi@15a00000 {
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
channel@0 {
reg = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
e3326_csi_in0: endpoint@0 {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&e3326_ov5693_out0>;
};
};
port@1 {
reg = <1>;
e3326_csi_out0: endpoint@1 {
remote-endpoint = <&e3326_vi_in0>;
};
};
};
};
};
};
i2c@3180000 {
ov5693_c@36 {
compatible = "nvidia,ov5693";
/* I2C device address */
reg = <0x36>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "3.674";
physical_h = "2.738";
/* Define any required hw resources needed by driver */
/* ie. clocks, io pins, power sources */
avdd-reg = "vana";
iovdd-reg = "vif";
/* Sensor output flip settings */
vertical-flip = "true";
mode0 { // OV5693_MODE_2592X1944
mclk_khz = "24000";
num_lanes = "4";
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "1920";
active_h = "1080";
mode_type = "bayer";
pixel_phase = "rggb";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "2688";
inherent_gain = "1";
mclk_multiplier = "6.67";
pix_clk_hz = "160000000";
gain_factor = "10";
min_gain_val = "10";/* 1DB*/
max_gain_val = "160";/* 16DB*/
step_gain_val = "1";
default_gain = "10";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
framerate_factor = "1000000";
min_framerate = "1816577";/*1.816577 */
max_framerate = "30000000";/*30*/
step_framerate = "1";
default_framerate = "30000000";
exposure_factor = "1000000";
min_exp_time = "34";/* us */
max_exp_time = "550385";/* us */
step_exp_time = "1";
default_exp_time = "33334";/* us */
embedded_metadata_height = "0";
};
// mode1 { //OV5693_MODE_2592X1458
// mclk_khz = "24000";
// num_lanes = "2";
// tegra_sinterface = "serial_c";
// phy_mode = "DPHY";
// discontinuous_clk = "yes";
// dpcm_enable = "false";
// cil_settletime = "0";
//
// active_w = "2592";
// active_h = "1458";
// mode_type = "bayer";
// pixel_phase = "bggr";
// csi_pixel_bit_depth = "10";
// readout_orientation = "0";
// line_length = "2688";
// inherent_gain = "1";
// mclk_multiplier = "6.67";
// pix_clk_hz = "160000000";
//
// gain_factor = "10";
// min_gain_val = "10";/* 1DB*/
// max_gain_val = "160";/* 16DB*/
// step_gain_val = "1";
// default_gain = "10";
// min_hdr_ratio = "1";
// max_hdr_ratio = "1";
// framerate_factor = "1000000";
// min_framerate = "1816577";/*1.816577 */
// max_framerate = "30000000";/*30*/
// step_framerate = "1";
// default_framerate = "30000000";
// exposure_factor = "1000000";
// min_exp_time = "34";/* us */
// max_exp_time = "550385";/* us */
// step_exp_time = "1";
// default_exp_time = "33334";/* us */
// embedded_metadata_height = "0";
// };
//
// mode2 { //OV5693_MODE_1280X720
// mclk_khz = "24000";
// num_lanes = "2";
// tegra_sinterface = "serial_c";
// phy_mode = "DPHY";
// discontinuous_clk = "yes";
// dpcm_enable = "false";
// cil_settletime = "0";
//
// active_w = "1280";
// active_h = "720";
// mode_type = "bayer";
// pixel_phase = "bggr";
// csi_pixel_bit_depth = "10";
// readout_orientation = "0";
// line_length = "1752";
// inherent_gain = "1";
// mclk_multiplier = "6.67";
// pix_clk_hz = "160000000";
//
// gain_factor = "10";
// min_gain_val = "10";/* 1DB*/
// max_gain_val = "160";/* 16DB*/
// step_gain_val = "1";
// default_gain = "10";
// min_hdr_ratio = "1";
// max_hdr_ratio = "1";
// framerate_factor = "1000000";
// min_framerate = "2787078";/* 2.787078 */
// max_framerate = "120000000";/* 120*/
// step_framerate = "1";
// default_framerate = "120000000";
// exposure_factor = "1000000";
// min_exp_time = "22";/* us */
// max_exp_time = "358733";/* us */
// step_exp_time = "1";
// default_exp_time = "8334";/* us */
// embedded_metadata_height = "0";
// };
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
e3326_ov5693_out0: endpoint {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&e3326_csi_in0>;
};
};
};
};
};
e3326_lens_ov5693@P5V27C {
min_focus_distance = "0.0";
hyper_focal = "0.0";
focal_length = "2.67";
f_number = "2.0";
aperture = "2.0";
};
tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
num_csi_lanes = <4>;
max_lane_speed = <1500000>;
min_bits_per_pixel = <8>;
vi_peak_byte_per_pixel = <2>;
vi_bw_margin_pct = <25>;
max_pixel_rate = <160000>;
isp_peak_byte_per_pixel = <5>;
isp_bw_margin_pct = <25>;
modules {
module0 {
badge = "e3326_front_P5V27C";
position = "rear";
orientation = "1";
drivernode0 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "ov5693 2-0036";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@3180000/ov5693_c@36";
};
drivernode1 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_lens";
proc-device-tree = "/proc/device-tree/e3326_lens_ov5693@P5V27C/";
};
};
};
};
};
(2)修改 tegra194-p2822-0000-camera-e3326-a00.dts
这里修改不多;
主要是使用的RST & PWDN 等GPIO管脚;
以及时钟电源等
#include <t19x-common-modules/tegra194-camera-e3326-a00.dtsi>
#include "dt-bindings/clock/tegra194-clock.h"
#define CAM0_RST_L TEGRA194_MAIN_GPIO(H, 3)
#define CAM0_PWDN TEGRA194_MAIN_GPIO(H, 6)
/* camera control gpio definitions */
/ {
i2c@3180000 {
ov5693_c@36 {
/* Define any required hw resources needed by driver */
/* ie. clocks, io pins, power sources */
/* mclk-index indicates the index of the */
/* mclk-name with in the clock-names array */
clocks = <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>,
<&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
clock-names = "extperiph1", "pllp_grtba";
mclk = "extperiph1";
clock-frequency = <24000000>;
reset-gpios = <&tegra_main_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>;
pwdn-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
vana-supply = <&p2822_avdd_cam_2v8>;
vif-supply = <&p2822_vdd_1v8_cvb>;
status = "okay";
};
};
gpio@2200000 {
camera-control-output-low {
gpio-hog;
output-low;
gpios = <CAM0_RST_L 0 CAM0_PWDN 0>;
label = "cam0-rst", "cam0-pwdn";
};
};
};
(3)关闭 plugin manager.
因为xavier平台默认是使用插件模式进行设备管理的;
相机模块也是通过插件管理的;
所以这里单独配置某个相机模块时,需要将插件管理关闭
#include "common/tegra194-p2888-0001-p2822-0000-common.dtsi"
//#include "common/tegra194-p2822-camera-modules.dtsi"
//#include "t19x-common-modules/tegra194-camera-plugin-manager.dtsi"
#include "common/tegra194-p2822-0000-camera-e3326-a00.dtsi"
(4)编辑ov5693.c
这里主要修改图像分辨率和帧率
#ifndef __OV5693_TABLES__
#define __OV5693_TABLES__
#include <media/camera_common.h>
#define OV5693_TABLE_WAIT_MS 0
#define OV5693_TABLE_END 1
#define OV5693_MAX_RETRIES 3
#define OV5693_WAIT_MS 10
#define ov5693_reg struct reg_8
static const ov5693_reg ov5693_start[] = {
{0x0100, 0x01}, /* mode select streaming on */
{OV5693_TABLE_END, 0x00}
};
static const ov5693_reg ov5693_stop[] = {
{0x0100, 0x00}, /* mode select streaming on */
{OV5693_TABLE_END, 0x00}
};
static const ov5693_reg tp_colorbars[] = {
{0x0600, 0x00},
{0x0601, 0x02},
{OV5693_TABLE_WAIT_MS, OV5693_WAIT_MS},
{OV5693_TABLE_END, 0x00}
};
static const ov5693_reg mode_2592x1944[] = {
{OV5693_TABLE_WAIT_MS, OV5693_WAIT_MS},
{OV5693_TABLE_END, 0x0000}
};
enum {
OV5693_MODE_2592X1944,
OV5693_MODE_START_STREAM,
OV5693_MODE_STOP_STREAM,
OV5693_MODE_TEST_PATTERN
};
static const ov5693_reg *mode_table[] = {
[OV5693_MODE_2592X1944] = mode_2592x1944,
[OV5693_MODE_START_STREAM] = ov5693_start,
[OV5693_MODE_STOP_STREAM] = ov5693_stop,
[OV5693_MODE_TEST_PATTERN] = tp_colorbars,
};
static const int ov5693_30fps[] = {
30,
};
static const struct camera_common_frmfmt ov5693_frmfmt[] = {
{{1920, 1080}, ov5693_30fps, 1, 0, OV5693_MODE_2592X1944},
};
#endif /* __OV5693_TABLES__ */
(5)内核配置
开启ov5693的驱动配置
kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig.
CONFIG_VIDEO_OV5693=y
(6)编译内核
(7)刷写内核
$ sudo ./flash.sh -k kernel-dtb jetson-xavier mmcblk0p1
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
96
8
评论
打赏
- 分享
- 举报
评论
6个
手气红包
相关专栏
-
浏览量:16536次2021-02-19 17:01:32
-
浏览量:1000次2023-04-19 09:13:30
-
浏览量:5309次2021-06-25 09:46:07
-
浏览量:7400次2021-05-11 17:51:48
-
浏览量:8710次2021-01-15 16:31:31
-
浏览量:4993次2020-08-04 20:11:36
-
浏览量:11249次2021-06-16 17:06:40
-
浏览量:1692次2024-03-01 16:01:03
-
浏览量:7868次2021-06-17 14:48:29
-
浏览量:6253次2021-07-15 16:35:07
-
浏览量:1501次2020-08-05 20:47:40
-
浏览量:10184次2021-06-08 17:32:00
-
浏览量:8621次2021-03-16 14:44:24
-
浏览量:12695次2021-02-26 11:19:50
-
浏览量:4665次2021-05-17 17:26:59
-
2024-08-23 14:25:36
-
浏览量:1955次2019-11-07 14:15:02
-
2024-02-02 14:41:10
-
浏览量:1228次2024-02-02 10:51:53
切换马甲
上一页
下一页
打赏用户
共 1 位
我要创作
分享技术经验,可获取创作收益
分类专栏
-
178篇
热门专栏
- 这里有光!AI赋力病情诊断,为糖尿病视网膜病变患者“延续光明”
- NVIDIA Tegra将引领移动产业变革!让视觉计算无处不在
- 新品发布 | NVIDIA AI Enterprise 软件现已全球上市,各行业获取AI变得触手可及
- 逢6必火 NVIDIA GeForce甜点级显卡历代记
- nvidia xavier nx平台HDMIDP视频输出红色噪声调试
- Arm 现已支持 RTX!全球广泛应用的 CPU 架构融合实时光线追踪、DLSS
- AI 艺术画廊 —— 用 AI 诠释艺术与音乐 十二
- VR解剖“历险记”:NVIDIA CloudXR 和 5G 赋力大学科学可视化
- xavier nx 平台 EQOS LAN端口连接异常问题调试2
- 自由度更高!《蝙蝠侠:阿卡姆骑士》游戏简介
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
打赏成功!
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注
你好,我有问题想请教你,可以加我qq 376495350.
好的
我这里有个没有驱动的mipi摄像头,也想借ov5693的驱动识别出来,方便加个QQ66760505,请教一下吗?
有驱动的啊
大侠你好,请问你的mipi输入设备是没有驱动的吗?