Orin nx max9296 + max9295 + uyvy sensor driver ctrl Gain range update failed message

关键信息:目前我在设备树上的 use_sensor_mode_id = false; 驱动中 set_gain的实现函数中直接 return 0;不进行任何操作;在r35.5.0版本上进行开发。可以帮忙分析下这个问题吗?目前可以初步判断为 tegracam_init_ctrl_ranges_by_mode接口中返回的错误,但我并不能很快的分析出具体原因,

It could be the gain didn’t define in device tree.
You can just copy from any reference sensor to verify it.

我的device tree 的default gain 小于 min gain导致,驱动正常了

不是很理解为什么我是yuv摄像头,却还是需要设置这些属性

It could be your sensor driver implement the gain CID. You can remove those control function in your sensor driver to ignore those configuration in device tree.

1 Like

我已经生成驱动了,但是run:gst-launch-1.0 v4l2src device=/dev/video1 ! ‘video/x-raw, format=UYVY, width=1920, height=1080, framerate=30/1’ ! xvimagesink -ev ;;; no image ;;; log is [dmesg]:[ 3306.864485] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[ 3306.872920] tegra-camrtc-capture-vi tegra-capture-vi: vi capture setup failed
[ 3307.888876] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[ 3307.897247] tegra194-vi5 13e40000.host1x:vi0@15c00000: csi_stream_release: failed to disable nvcsi tpg on stream 0 virtual channel 1
;;;
[console]st-launch-1.0 v4l2src device=/dev/video1 ! ‘video/x-raw, format=UYVY, width=1920, height=1080, framerate=30/1’ ! xvimagesink -ev
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstXvImageSink:xvimagesink0.GstPad:sink: caps = video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
gstv4l2src.c(660): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
EOS on shutdown enabled – waiting for EOS after Error
Waiting for EOS…
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: Output window was closed
Additional debug info:
xvimagesink.c(554): gst_xv_image_sink_handle_xevents (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0

^Chandling interrupt.
Interrupt: Stopping pipeline …
Interrupt while waiting for EOS - stopping pipeline…
Execution ended after 0:00:05.438277052
Setting pipeline to NULL …
Freeing pipeline …

Get the trace log.

https://elinux.org/Jetson/l4t/Camera_BringUp

1383.907419] bwmgr API not supported
[ 1383.915551] camera_sensor 9-0030: mode id= 0
[ 1386.418845] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 1386.428588] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 1386.438221] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1386.446413] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 1386.457109] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1386.465953] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 1388.978823] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 1388.987976] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 1388.997571] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1389.005308] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 1389.015976] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1390.034806] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[ 1390.043139] tegra194-vi5 13e40000.host1x:vi0@15c00000: vi_capture_control_send_message: failed to send IVC control message
[ 1391.058801] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[ 1391.067195] tegra-camrtc-capture-vi tegra-capture-vi: vi capture setup failed
[ 1391.074554] tegra-camrtc-capture-vi tegra-capture-vi: fatal: error recovery failed
[ 1419.132801] ------------[ cut here ]------------
[ 1419.137590] refcount_t: addition on 0; use-after-free.
[ 1419.137622] WARNING: CPU: 3 PID: 3346 at lib/refcount.c:25 refcount_warn_saturate+0x98/0x140
[ 1419.146328] Modules linked in: nvidia_modeset(OE) fuse(E) lzo_rle(E) lzo_compress(E) zram(E) ramoops(E) reed_solomon(E) loop(E) bnep(E) hid_logitech_hidpp(E) input_leds(E) snd_soc_tegra186_asrc(E) snd_soc_tegra210_iqc(E) snd_soc_tegra210_ope(E) snd_soc_tegra186_arad(E) snd_soc_tegra186_dspk(E) snd_soc_tegra210_mvc(E) snd_soc_tegra210_afc(E) snd_soc_tegra210_dmic(E) snd_soc_tegra210_adx(E) snd_soc_tegra210_amx(E) hid_logitech_dj(E) snd_soc_tegra210_mixer(E) snd_soc_tegra210_i2s(E) snd_soc_tegra210_admaif(E) snd_soc_tegra210_sfc(E) snd_soc_tegra_pcm(E) aes_ce_blk(E) crypto_simd(E) cryptd(E) aes_ce_cipher(E) rtk_btusb(E) ghash_ce(E) btusb(E) btrtl(E) btbcm(E) btintel(E) sha2_ce(E) sha256_arm64(E) sha1_ce(E) snd_soc_tegra_machine_driver(E) snd_soc_spdif_tx(E) rtl8822ce(E) fusb301(E) userspace_alert(E) snd_soc_tegra210_ahub(E) snd_soc_tegra210_adsp(E) snd_hda_codec_hdmi(E) tegra_bpmp_thermal(E) snd_soc_tegra_utils(E) snd_hda_tegra(E) snd_soc_simple_card_utils(E) cfg80211(E) snd_hda_codec(E)
[ 1419.146466] nvadsp(E) snd_hda_core(E) tegra210_adma(E) spi_tegra114(E) r8168(E) nvidia(OE) binfmt_misc(E) ina3221(E) pwm_fan(E) nvgpu(E) nvmap(E) ip_tables(E) x_tables(E) [last unloaded: mtd]
[ 1419.146508] CPU: 3 PID: 3346 Comm: gst-launch-1.0 Tainted: G OE 5.10.192-tegra #2
[ 1419.146511] Hardware name: NVIDIA Orin NX Developer Kit (DT)
[ 1419.146517] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=–)
[ 1419.146522] pc : refcount_warn_saturate+0x98/0x140
[ 1419.146526] lr : refcount_warn_saturate+0x98/0x140
[ 1419.146528] sp : ffff800028e3ba40
[ 1419.146531] x29: ffff800028e3ba40 x28: ffff7885a8747300
[ 1419.146538] x27: 0000000040045613 x26: 0000000000000000
[ 1419.146544] x25: ffff800028e3bd08 x24: ffff7885013861f8
[ 1419.146550] x23: ffff788594f1d880 x22: ffff800028e3bd08
[ 1419.146556] x21: ffff788594f19db0 x20: ffff788501386550
[ 1419.146563] x19: ffff788594f19d80 x18: 0000000000000010
[ 1419.146569] x17: 0000000000000000 x16: ffffd252828b50f0
[ 1419.146574] x15: ffff788594f1ddf0 x14: ffffffffffffffff
[ 1419.146580] x13: ffff8000a8e3b677 x12: ffff800028e3b67f
[ 1419.146585] x11: 071c71c71c71c71c x10: 0000000000000ab0
[ 1419.146591] x9 : ffff800028e3ba40 x8 : 6572662d72657466
[ 1419.146597] x7 : 612d657375203b30 x6 : c0000000ffffefff
[ 1419.146603] x5 : ffff78886e8e5978 x4 : ffffd252845c7ba8
[ 1419.146608] x3 : 0000000000000001 x2 : ffff78886e8e5980
[ 1419.146614] x1 : 0000000000000000 x0 : 0000000000000000
[ 1419.146620] Call trace:
[ 1419.146625] refcount_warn_saturate+0x98/0x140
[ 1419.146631] kthread_stop+0x4c/0x290
[ 1419.146638] vi5_channel_stop_kthreads+0x44/0x60
[ 1419.146642] vi5_channel_stop_streaming+0xa8/0xb0
[ 1419.146648] tegra_channel_stop_streaming+0x3c/0x70
[ 1419.146652] __vb2_queue_cancel+0x40/0x220
[ 1419.146656] vb2_core_streamoff+0x34/0xd0
[ 1419.146661] vb2_streamoff+0x34/0x80
[ 1419.146665] vb2_ioctl_streamoff+0x58/0x70
[ 1419.146671] v4l_streamoff+0x40/0x50
[ 1419.146675] __video_do_ioctl+0x188/0x400
[ 1419.146678] video_usercopy+0x280/0x7e0
[ 1419.146682] video_ioctl2+0x40/0x100
[ 1419.146686] v4l2_ioctl+0x68/0x90
[ 1419.146694] __arm64_sys_ioctl+0xac/0xf0
[ 1419.146700] el0_svc_common.constprop.0+0x80/0x1d0
[ 1419.146706] do_el0_svc+0x38/0xc0
[ 1419.146712] el0_svc+0x1c/0x30
[ 1419.146716] el0_sync_handler+0xa8/0xb0
[ 1419.146720] el0_sync+0x16c/0x180
[ 1419.146724] —[ end trace e228a8db7c9e8eac ]—
[ 1419.151504] ------------[ cut here ]------------
[ 1419.156266] refcount_t: underflow; use-after-free.
[ 1419.156283] WARNING: CPU: 3 PID: 3346 at lib/refcount.c:28 refcount_warn_saturate+0xec/0x140
[ 1419.164960] Modules linked in: nvidia_modeset(OE) fuse(E) lzo_rle(E) lzo_compress(E) zram(E) ramoops(E) reed_solomon(E) loop(E) bnep(E) hid_logitech_hidpp(E) input_leds(E) snd_soc_tegra186_asrc(E) snd_soc_tegra210_iqc(E) snd_soc_tegra210_ope(E) snd_soc_tegra186_arad(E) snd_soc_tegra186_dspk(E) snd_soc_tegra210_mvc(E) snd_soc_tegra210_afc(E) snd_soc_tegra210_dmic(E) snd_soc_tegra210_adx(E) snd_soc_tegra210_amx(E) hid_logitech_dj(E) snd_soc_tegra210_mixer(E) snd_soc_tegra210_i2s(E) snd_soc_tegra210_admaif(E) snd_soc_tegra210_sfc(E) snd_soc_tegra_pcm(E) aes_ce_blk(E) crypto_simd(E) cryptd(E) aes_ce_cipher(E) rtk_btusb(E) ghash_ce(E) btusb(E) btrtl(E) btbcm(E) btintel(E) sha2_ce(E) sha256_arm64(E) sha1_ce(E) snd_soc_tegra_machine_driver(E) snd_soc_spdif_tx(E) rtl8822ce(E) fusb301(E) userspace_alert(E) snd_soc_tegra210_ahub(E) snd_soc_tegra210_adsp(E) snd_hda_codec_hdmi(E) tegra_bpmp_thermal(E) snd_soc_tegra_utils(E) snd_hda_tegra(E) snd_soc_simple_card_utils(E) cfg80211(E) snd_hda_codec(E)
[ 1419.165031] nvadsp(E) snd_hda_core(E) tegra210_adma(E) spi_tegra114(E) r8168(E) nvidia(OE) binfmt_misc(E) ina3221(E) pwm_fan(E) nvgpu(E) nvmap(E) ip_tables(E) x_tables(E) [last unloaded: mtd]
[ 1419.165051] CPU: 3 PID: 3346 Comm: gst-launch-1.0 Tainted: G W OE 5.10.192-tegra #2
[ 1419.165053] Hardware name: NVIDIA Orin NX Developer Kit (DT)
[ 1419.165056] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=–)
[ 1419.165059] pc : refcount_warn_saturate+0xec/0x140
[ 1419.165061] lr : refcount_warn_saturate+0xec/0x140
[ 1419.165062] sp : ffff800028e3ba40
[ 1419.165064] x29: ffff800028e3ba40 x28: ffff7885a8747300
[ 1419.165068] x27: 0000000040045613 x26: 0000000000000000
[ 1419.165072] x25: ffff800028e3bd08 x24: ffff7885013861f8
[ 1419.165075] x23: ffff788594f1d880 x22: ffff800028e3bd08
[ 1419.165079] x21: ffff788594f19db0 x20: 0000000000000000
[ 1419.165083] x19: ffff788594f19d80 x18: 0000000000000010
[ 1419.165086] x17: 0000000000000000 x16: ffffd252828b50f0
[ 1419.165090] x15: ffff788594f1ddf0 x14: ffffffffffffffff
[ 1419.165094] x13: ffff8000a8e3b677 x12: ffff800028e3b67f
[ 1419.165098] x11: 071c71c71c71c71c x10: 0000000000000ab0
[ 1419.165102] x9 : ffff800028e3ba40 x8 : 72657466612d6573
[ 1419.165105] x7 : 75203b776f6c6672 x6 : c0000000ffffefff
[ 1419.165109] x5 : ffff78886e8e5978 x4 : ffffd252845c7ba8
[ 1419.165113] x3 : 0000000000000001 x2 : ffff78886e8e5980
[ 1419.165116] x1 : 0000000000000000 x0 : 0000000000000000
[ 1419.165120] Call trace:
[ 1419.165123] refcount_warn_saturate+0xec/0x140
[ 1419.165126] kthread_stop+0x27c/0x290
[ 1419.165129] vi5_channel_stop_kthreads+0x44/0x60
[ 1419.165132] vi5_channel_stop_streaming+0xa8/0xb0
[ 1419.165136] tegra_channel_stop_streaming+0x3c/0x70
[ 1419.165138] __vb2_queue_cancel+0x40/0x220
[ 1419.165141] vb2_core_streamoff+0x34/0xd0
[ 1419.165144] vb2_streamoff+0x34/0x80
[ 1419.165147] vb2_ioctl_streamoff+0x58/0x70
[ 1419.165150] v4l_streamoff+0x40/0x50
[ 1419.165152] __video_do_ioctl+0x188/0x400
[ 1419.165155] video_usercopy+0x280/0x7e0
[ 1419.165157] video_ioctl2+0x40/0x100
[ 1419.165160] v4l2_ioctl+0x68/0x90
[ 1419.165164] __arm64_sys_ioctl+0xac/0xf0
[ 1419.165168] el0_svc_common.constprop.0+0x80/0x1d0
[ 1419.165172] do_el0_svc+0x38/0xc0
[ 1419.165175] el0_svc+0x1c/0x30
[ 1419.165178] el0_sync_handler+0xa8/0xb0
[ 1419.165180] el0_sync+0x16c/0x180
[ 1419.165182] —[ end trace e228a8db7c9e8ead ]—
[ 1419.173717] bwmgr API not supported
[ 1419.234819] [RCE] WARNING: core/hsp/hsp-vm.c:283 [camrtc_hsp_full_ss_isr] “VM0 issued IVC in inactive state.”
[ 1420.211045] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[ 1420.219404] tegra194-vi5 13e40000.host1x:vi0@15c00000: csi_stream_release: failed to disable nvcsi tpg on stream 0 virtual channel 0

i change command : gst-launch-1.0 -v v4l2src device=“/dev/video0” ! video/x-raw,framerate=30/1,width=1920,height=1080 ! xvimagesink ,;;;
in dtsi:
serdes_pix_clk_hz = “300000000” max9296 set PCLK is 23592630

What’s the version?
Get the trace log from below.

sudo su
echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 2 > /sys/kernel/debug/camrtc/log-level
echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
echo > /sys/kernel/debug/tracing/trace
v4l2-ctl --stream-mmap -c bypass_mode=0 

cat /sys/kernel/debug/tracing/trace

tracer: nop

    v4l2-ctl-3624    [003] ....   532.677484: tegra_channel_open: vi-output, camera_sensor 9-0030
    v4l2-ctl-3624    [003] ....   532.683363: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1080 fmt 13
    v4l2-ctl-3624    [003] ....   534.739609: tegra_channel_close: vi-output, camera_sensor 9-0030
 kworker/3:0-30      [003] ....   539.830989: rtcpu_string: tstamp:17451513308 id:0x04010000 str:"VM0 deactivating."

r35.5.0

Looks like NVCSI/VI doesn’t get any validate data from sensor.
Please probe the MIPI signal to confirm it.

Thanks

 kworker/0:2-95      [000] ....   155.867001: rtcpu_string: tstamp:5475275607 id:0x04010000 str:"VM0 deactivating."
    v4l2-ctl-5388    [002] ....   181.171982: tegra_channel_open: vi-output, camera_sensor 9-0030
    v4l2-ctl-5388    [002] ....   181.178053: tegra_channel_set_power: camera_sensor 9-0030 : 0x1
    v4l2-ctl-5388    [002] ....   181.178064: camera_common_s_power: status : 0x1
    v4l2-ctl-5388    [002] ....   181.178072: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x1
    v4l2-ctl-5388    [002] ....   181.178075: csi_s_power: enable : 0x1
    v4l2-ctl-5388    [003] ....   181.178734: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1080 fmt 13
    v4l2-ctl-5388    [003] ....   181.185632: tegra_channel_set_stream: enable : 0x1
    v4l2-ctl-5388    [003] ....   181.197273: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x1
    v4l2-ctl-5388    [003] ....   181.197277: csi_s_stream: enable : 0x1
    v4l2-ctl-5388    [003] ....   181.197600: tegra_channel_set_stream: camera_sensor 9-0030 : 0x1
 kworker/0:2-95      [000] ....   181.218496: rtcpu_string: tstamp:6266716101 id:0x04010000 str:"VM0 activating."
 kworker/0:2-95      [000] ....   181.218500: rtcpu_vinotify_event: tstamp:6267370796 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:200539431040 data:0x759d580010000000
 kworker/0:2-95      [000] ....   181.218500: rtcpu_vinotify_event: tstamp:6267370930 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:200539437472 data:0x0000000031000001
 kworker/0:2-95      [000] ....   181.218500: rtcpu_vinotify_event: tstamp:6267371081 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:200539483168 data:0x759d550010000000
 kworker/0:2-95      [000] ....   181.218500: rtcpu_vinotify_event: tstamp:6267371212 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:200539489728 data:0x0000000031000002

vi-output, came-5390 [002] … 183.771507: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1080 fmt 13
kworker/0:2-95 [000] … 183.802458: rtcpu_vinotify_event: tstamp:6348209080 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:203125922432 data:0x759d580010000000
kworker/0:2-95 [000] … 183.802460: rtcpu_vinotify_event: tstamp:6348209217 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:203125965120 data:0x0000000031000001
kworker/0:2-95 [000] … 183.802460: rtcpu_vinotify_event: tstamp:6348209371 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:203125982784 data:0x759d550010000000
kworker/0:2-95 [000] … 183.802461: rtcpu_vinotify_event: tstamp:6348209502 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:203126043136 data:0x0000000031000002
vi-output, came-5390 [001] … 187.362257: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1080 fmt 13
kworker/0:2-95 [000] … 194.670408: rtcpu_string: tstamp:6686618489 id:0x04010000 str:“VM0 deactivating.”

in r35.4.1;

Do you have any other suggestions? Thanks

我怀疑是我的流的id设置的问题,请问orin的相机框架怎么识别流id的

The stream-id is bounding with port-index aka CSI port number.

我发现我的CSI_CLK上没有信号