The v4l2-ctl command is freeze

I use an imx297 sensor and when I try to get the image using Argus there is no problem and I can get one frame. But when I use the v4l2-ctl command, no data is received and nothing happens until I stop the process.

v4l2-ctl -d /dev/video0  --set-ctrl bypass_mode=0 --stream-mmap --stream-count=-1 --stream-to=/dev/null

sudo dmesg

[ 1791.752003] bwmgr API not supported
[ 1791.769662] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 79, flags: 0, err_data 131072
[ 1791.779907] imx297 9-001a: COMMON imx297_set_mode:
[ 1791.783565] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 80, flags: 0, err_data 131072
[ 1791.793865] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 81, flags: 0, err_data 131072
[ 1791.804161] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 82, flags: 0, err_data 131072
[ 1791.805388] imx297 9-001a: imx297_set_gain: gain: 1
[ 1791.819806] imx297 9-001a: imx297_set_gain: 0x3205: 0
[ 1791.825088] imx297 9-001a: imx297_set_gain: 0x3204: 1

hello talagimi63,

there’re discarding frame warning messages, which indicate an invalidate capture status, hence it’s dropping current captures.
I assume your system still alive by issue ctrl^c (or, kill v4l2 PID) to terminate the process, right?

if yes,
please refer to Debugging Tips section to examine your sensor driver implementation .

I got this information using debug

v4l2-ctl-2395    [002] ....   291.512186: tegra_channel_open: vi-output, imx297 9-001a
        v4l2-ctl-2395    [002] ....   291.513952: tegra_channel_set_power: imx297 9-001a : 0x1
        v4l2-ctl-2395    [002] ....   291.513962: camera_common_s_power: status : 0x1
        v4l2-ctl-2395    [002] ....   291.814283: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x1
        v4l2-ctl-2395    [002] ....   291.814290: csi_s_power: enable : 0x1
        v4l2-ctl-2395    [002] ....   291.816301: tegra_channel_capture_setup: vnc_id 0 W 728 H 544 fmt c4
        v4l2-ctl-2395    [002] ....   291.829671: tegra_channel_set_stream: enable : 0x1
        v4l2-ctl-2395    [002] ....   291.834847: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x1
        v4l2-ctl-2395    [002] ....   291.834850: csi_s_stream: enable : 0x1
        v4l2-ctl-2395    [002] ....   291.835266: tegra_channel_set_stream: imx297 9-001a : 0x1
     kworker/3:3-128     [003] ....   291.877996: rtcpu_string: tstamp:9843961466 id:0x04010000 str:"VM0 activating."
     kworker/3:3-128     [003] ....   291.878001: rtcpu_vinotify_error: tstamp:9844293635 cch:-1 vi:0 tag:CSIMUX_STREAM channel:0x00 frame:0 vi_tstamp:315017361824 data:0x0000000000000001
     kworker/3:3-128     [003] ....   291.878003: rtcpu_vinotify_event: tstamp:9844423486 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:315011395424 data:0x719d580010000000
     kworker/3:3-128     [003] ....   291.878003: rtcpu_vinotify_event: tstamp:9844423747 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:315011405184 data:0x0000000031000001
     kworker/3:3-128     [003] ....   291.878004: rtcpu_vinotify_event: tstamp:9844424036 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:315011496224 data:0x719d550010000000
     kworker/3:3-128     [003] ....   291.878004: rtcpu_vinotify_event: tstamp:9844424286 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:315011506144 data:0x0000000031000002
     kworker/3:3-128     [003] ....   291.878004: rtcpu_vinotify_event: tstamp:9844424566 cch:-1 vi:0 tag:CSIMUX_STREAM channel:0x00 frame:0 vi_tstamp:315017361824 data:0x0000000000000001
     kworker/3:3-128     [003] ....   291.878005: rtcpu_vinotify_event: tstamp:9844736326 cch:0 vi:0 tag:FS channel:0x00 frame:247 vi_tstamp:315023442880 data:0x000000f700000010
     kworker/3:3-128     [003] ....   291.878005: rtcpu_vinotify_event: tstamp:9844736650 cch:0 vi:0 tag:ATOMP_FS channel:0x00 frame:247 vi_tstamp:315023442912 data:0x0000000800000000
     kworker/3:3-128     [003] ....   291.878005: rtcpu_vinotify_event: tstamp:9844736904 cch:0 vi:0 tag:CHANSEL_FAULT channel:0x23 frame:247 vi_tstamp:315023457504 data:0x0000000000004004
     kworker/3:3-128     [003] ....   291.878006: rtcpu_vinotify_event: tstamp:9844737184 cch:0 vi:0 tag:VIFALC_ACTIONLST channel:0x23 frame:247 vi_tstamp:315023466304 data:0x0000000001020001
     kworker/3:3-128     [003] ....   291.878006: rtcpu_vinotify_event: tstamp:9844737433 cch:0 vi:0 tag:CHANSEL_NOMATCH channel:0x01 frame:247 vi_tstamp:315023572640 data:0x00000000000006e9
     kworker/3:3-128     [003] ....   291.878006: rtcpu_vinotify_event: tstamp:9844737716 cch:0 vi:0 tag:CHANSEL_FAULT channel:0x23 frame:247 vi_tstamp:315023630336 data:0x0000000000004001
     kworker/3:3-128     [003] ....   291.878006: rtcpu_vinotify_event: tstamp:9844737966 cch:0 vi:0 tag:CHANSEL_FAULT channel:0x23 frame:247 vi_tstamp:315031461216 data:0x00000000021f4002
     kworker/3:3-128     [003] ....   291.878007: rtcpu_vinotify_event: tstamp:9844738246 cch:0 vi:0 tag:ATOMP_FRAME_DONE channel:0x23 frame:247 vi_tstamp:315031462048 data:0x0000000000000000
     kworker/3:3-128     [003] ....   291.878007: rtcpu_vinotify_event: tstamp:9844738490 cch:0 vi:0 tag:CHANSEL_FAULT channel:0x23 frame:247 vi_tstamp:315031469600 data:0x0000000002204040
     kworker/3:3-128     [003] ....   291.878007: rtcpu_vinotify_event: tstamp:9844738768 cch:0 vi:0 tag:FE channel:0x00 frame:247 vi_tstamp:315031512704 data:0x000000f700000020

hello talagimi63,

VI is expecting SOF and EOF signaling, which indicate a complete frame, however, there an error with CHANSEL_FAULT. the error code 0x4004 shows failure with first embedded byte in a frame.

hence,
please examine whether your sensor is outputting embedded metadata. you should also configure device tree property embedded_metadata_height as same as your sensor output. if sensor does not support embedded metadata, the value should be 0.

I set the value of embedded_metadata_height to 2 and shared the
imx297_log.txt (30.3 KB)

On the other hand, according to the image related to ALL-pixel, I set the Device tree list register like this:
imx297_timing_2

mode0 { // All Pixel Mode
					num_lanes                = "1";
					embedded_metadata_height = "2";
					readout_orientation      = "0";

					mclk_khz = "54000";
					tegra_sinterface = "serial_a";
					phy_mode = "DPHY";
					discontinuous_clk = "no";
					dpcm_enable = "true";
					cil_settletime =  "0";

					active_l = "0";
					active_t = "0";
					active_w = "728";
					active_h = "544";

					mode_type = "bayer";
					pixel_phase = "bggr";

					csi_pixel_bit_depth = "10";
					line_length = "1070";

Where is the problem?
Thanks for the help

hello talagimi63,

below tracing logs indicate that embedded metadata were parsed correctly.

     tag:CHANSEL_EMBED_SOF channel:0x23 frame:230 vi_tstamp:4864653798464 data:0x0000000000000004
     tag:CHANSEL_EMBED_EOF channel:0x23 frame:230 vi_tstamp:4864653818880 data:0x0000000000010008
     tag:ATOMP_EMB_DATA_DONE channel:0x23 frame:230 vi_tstamp:4864653819712 data:0x0000000000000000

please check your lane polarity settings since it’s Orin Nano, and you’re using CSI-A.
for instance, please refer to Jetson Orin NX Series and Orin Nano Series Design Guide for [Figure 10-1. CSI 2-Lane Connection Options].
i.e. CSI0 D1 and CSI1 D0 P/N will always been swizzled for P/N.

you may also check reference driver for lane_polarity DT settings.
for instance, $public_sources/kernel_src/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-camera-rbpcv2-imx219.dtsi

We are using the Jetson NX carrier board with Orin Nano and configuration P3767-0004 + P3509-0000. We utilize CSI data lines CSI_0_D0_N and CSI_0_D0_P, and clock lines CSI_0_CLK_N and CSI_0_CLK_P, with the polarity set to direct. In the device tree, we specify ‘tegra_sinterface=“serial_a”’ and ‘lane_polarity=“0”’. Everything works fine with the IMX296 sensor. However, we encounter issues when using the IMX297 sensor.

hello talagimi63,

this is not supported. please see-also Topic 250765.
please works with Jetson Orin Nano Developer Kit carrier board.