Xavier-Nx模块上使GPIO7和GPIO14为PWM8和PWM7
1.前言
使用GMSL的串行器和解串器9295 9296
两路imx390相机
有两种采集方式,一种是在前端拼接好作为一路采集;
另一种是独立采集,使用MIPI的虚拟通道;
下面为调试记录
2. 搭建环境
设备树:
只截取部分
{ num-channels = <2>;
ports { #address-cells = <1>;
#size-cells = <0>;
port@0 { reg = <0>;
imx390_vi_in0: endpoint { vc-id = <0>;
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&imx390_csi_out0>; }; };
port@1 { reg = <1>;
imx390_vi_in1: endpoint { vc-id = <1>;
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&imx390_csi_out1>; }; }; }; }
mode0 {/*mode IMX390_MODE_1920X1080_CROP_30FPS*/ mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
vc_id = "0";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = "0";
dynamic_pixel_bit_depth = "8";
csi_pixel_bit_depth = "8";
mode_type = "bayer";
pixel_phase = "rggb";
active_w = "256";
active_h = "1";
readout_orientation = "0";
line_length = "300";
inherent_gain = "1";
pix_clk_hz = "337500000";
serdes_pix_clk_hz = "337500000";
gain_factor = "10";
min_gain_val = "0"; /* dB */
max_gain_val = "300"; /* dB */
step_gain_val = "3"; /* 0.3 */
default_gain = "0";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
framerate_factor = "1000000";
min_framerate = "30000000";
max_framerate = "30000000";
step_framerate = "1";
default_framerate = "30000000";
exposure_factor = "1000000";
min_exp_time = "59"; /*us, 2 lines*/
max_exp_time = "33333";
step_exp_time = "1";
default_exp_time = "33333";/* us */
embedded_metadata_height = "0"; };
驱动:使用官方驱动直接进行移植
/hardware/nvidia/platform/t19x/下的两个设备树文件夹。
jakku/是NX平台的DT来源,galen/包括Xavier平台的DT。
驱动加载ok
[ 5.334391] imx390 30-001b: probing v4l2 sensor.
[ 5.335400] imx390 30-001b: tegracam sensor driver:imx390_v2.0.6
[ 5.335498] imx390 30-001b: Detected IMX390 sensor
[ 5.335586] imx390 30-001c: probing v4l2 sensor.
[ 5.335767] imx390 30-001c: couldn’t create debugfs
[ 5.335970] imx390 30-001c: tegracam sensor driver:imx390_v2.0.6
[ 5.336033] imx390 30-001c: Detected IMX390 sensor
3. 视频采集
成功注册了Xavier NX板中的imx390驱动程序。
当采集数据时产生错误
kworker/0:0-4 [000] .... 436.167754: rtos_queue_peek_from_isr_failed: tstamp:14032721488 queue:0x0bcbcf78
v4l2-ctl-10518 [001] .... 436.255902: tegra_channel_set_stream: enable : 0x0
v4l2-ctl-10518 [001] .... 436.255906: tegra_channel_set_stream: imx390 30-001c : 0x0
v4l2-ctl-10518 [001] .... 436.255918: tegra_channel_set_stream: 15a00000.nvcsi--1 : 0x0
v4l2-ctl-10518 [001] .... 436.255920: csi_s_stream: enable : 0x0
v4l2-ctl-10518 [000] .... 436.261468: tegra_channel_set_power: imx390 30-001c : 0x0
v4l2-ctl-10518 [000] .... 436.261483: camera_common_s_power: status : 0x0
v4l2-ctl-10518 [000] .... 436.261617: tegra_channel_set_power: 15a00000.nvcsi--1 : 0x0
v4l2-ctl-10518 [000] .... 436.261620: csi_s_power: enable : 0x0
kworker/0:0-4 [000] .... 436.279807: rtos_queue_send_from_isr_failed: tstamp:14036251427 queue:0x0bcb41f8
kworker/0:0-4 [000] .... 436.279823: rtos_queue_send_from_isr_failed: tstamp:14036251581 queue:0x0bcb8a60
kworker/0:0-4 [000] .... 436.279825: rtos_queue_send_from_isr_failed: tstamp:14036251737 queue:0x0bcba5e0
kworker/0:0-4 [000] .... 436.279826: rtos_queue_send_from_isr_failed: tstamp:14036251
(1)检查设备树的属性设置。
这些DT属性应该与实际的传感器MIPI信号相匹配。
VI引擎设置缓冲区接收信号根据设备树的属性
(2)看起来VI引擎没有收到帧信号。
看到PXL_SOF和PXL_EOF,表示帧的开始和结束。
(3)检查传感器像素时钟设置
相机软件使用传感器像素时钟来计算曝光和帧率的传感器。
必须正确配置pix_clk_hz
按照上面的思路,调整了设备树的各种参数
实现了2路拼接视频采集
4. 使用虚拟通道独立采集
(1)参考多虚拟通道驱动
设备树属性添加VC -id和vc_id的VC支持。
参考如下;
$L4T_Sources/r32.4.3/Linux_for_Tegra/source/public/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-modules/tegra186-camera-imx390-a00.dtsi
(2)调整端口绑定关系
启用了4个虚拟通道,驱动程序也成功加载。
但是sub dev和/dev/ videoo2和/dev/video3没有注册。我
日志如下
[ 0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
[ 0.429603] DTS File Name: …/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dts
[ 0.700706] DTS File Name: …/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dts
[ 0.719456] iommu: Adding device 3180000.i2c to group 12
[ 0.788194] vdd-sdmmc1-sw: 3300 mV
[ 1.457135] t194-nvcsi 15a00000.nvcsi: initialized
[ 2.118946] tegra194_cpufreq_probe: platform driver Initialization: pass
[ 2.146144] misc nvmap: cvsram :dma coherent mem declare 0x0000000050000000,4194304
[ 2.993281] tegra194-isp5 14800000.isp: initialized
[ 2.999694] tegra194-vi5 15c10000.vi: using default number of vi channels, 36
[ 3.006886] tegra194-vi5 15c10000.vi: initialized
[ 3.010860] tegra194-vi5 15c10000.vi: subdev 15a00000.nvcsi–2 bound
[ 3.010929] tegra194-vi5 15c10000.vi: subdev 15a00000.nvcsi–1 bound
[ 5.429971] tegra194-vi5 15c10000.vi: subdev imx390 30-001b bound
[ 5.431616] tegra194-vi5 15c10000.vi: subdev imx390 30-001c bound
[ 0.573907] CPU4: Booted secondary processor [4e0f0040]
[ 5.429320] imx390 30-001b: probing v4l2 sensor.
[ 5.429919] imx390 30-001b: tegracam sensor driver:imx390_v2.0.6
[ 5.429971] tegra194-vi5 15c10000.vi: subdev imx390 30-001b bound
[ 5.431118] imx390 30-001b: Detected IMX390 sensor
[ 5.431185] imx390 30-001c: probing v4l2 sensor.
[ 5.431366] imx390 30-001c: couldn’t create debugfs
[ 5.431579] imx390 30-001c: tegracam sensor driver:imx390_v2.0.6
[ 5.431616] tegra194-vi5 15c10000.vi: subdev imx390 30-001c bound
[ 5.432205] imx390 30-001c: Detected IMX390 sensor
[ 5.432288] imx390 30-001d: probing v4l2 sensor.
[ 5.432466] imx390 30-001d: couldn’t create debugfs
[ 5.432664] imx390 30-001d: tegracam sensor driver:imx390_v2.0.6
[ 5.432700] imx390 30-001d: Detected IMX390 sensor
[ 5.432812] imx390 30-001e: probing v4l2 sensor.
[ 5.432950] imx390 30-001e: couldn’t create debugfs
[ 5.433124] imx390 30-001e: tegracam sensor driver:imx390_v2.0.6
[ 5.433154] imx390 30-001e: Detected IMX390 sensor
调整设备树的端口绑定关系;
可解决上述问题
(3)MIPI速率问题
驱动程序在850Mbps以上工作正常。
但它不能在低于850Mbps的数据速率下工作。
我已经改变了解决时间,然后也没有改善
传感器可以通过配置将速率从200mbps配到1.3Gbps。
通过在imx390中配置传感器和dtsi(像素时钟和定位时间)文件来测试不同的数据速率。
在1.3Gbps和900Mbps的速度下工作,但是当传感器配置为650、450、220和350 Mbps时,它就不工作了
(4)添加set_mode_delay_ms
Xavier的VI引擎是定时敏感的,
尝试添加set_mode_delay_ms属性来增加第一帧的超时值。
set_mode_delay_ms |捕获开始后第一帧的最大等待时间,以毫秒为单位。
修改如下:
调试后仍无变化
(5)尝试设置固定硬编码时间
$L4T_Sources/r32.4.4/Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/platform/tegra/camera/nvcsi/csi5_fops.c
static int csi5_stream_set_config(struct tegra_csi_channel *chan, u32 stream_id, u32 csi_port, int csi_lanes)
{
...
unsigned int cil_settletime = read_settle_time_from_dt(chan);
修改后也无变化
5. 结尾
目前在高速率下是可以正常采集的;
但是配置低速率无法工作问题暂时还没解决;
有待后续深究
- 分享
- 举报
-
浏览量:8542次2021-05-14 14:43:43
-
浏览量:3176次2018-08-17 10:43:22
-
浏览量:2464次2020-08-30 09:43:41
-
浏览量:3875次2020-08-31 08:41:19
-
浏览量:10795次2021-05-06 16:22:01
-
浏览量:3136次2020-07-30 14:53:44
-
浏览量:1334次2023-01-10 09:33:14
-
浏览量:1941次2019-11-07 14:15:02
-
浏览量:10554次2020-10-13 17:41:07
-
浏览量:1390次2024-01-10 10:27:15
-
浏览量:7370次2021-05-11 17:51:48
-
浏览量:3495次2020-01-15 09:34:34
-
浏览量:8610次2021-03-16 14:44:24
-
浏览量:2430次2020-08-06 15:36:48
-
浏览量:7407次2021-06-09 14:29:23
-
浏览量:998次2023-12-08 16:48:29
-
浏览量:7911次2021-06-04 16:25:58
-
浏览量:9354次2021-04-27 17:56:41
-
浏览量:3750次2020-08-30 09:57:38
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
free-jdx
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明