JetsonTX2 L4T28.2.1 AuvideaJ90+LI-IMX264-MIPI-M12

Hello,
I am trying connect LI-IMX264-MIPI-M12.

nvidia@tegra-ubuntu:~$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'RG12'
	Name        : 12-bit Bayer RGRG/GBGB
		Size: Discrete 2464x2058
			Interval: Discrete 0.029s (35.000 fps)

But i can not get image with v4l2-ctl(or gst-launch or nvgstcapture) in camera’s resolution.

nvidia@tegra-ubuntu:~$ v4l2-ctl -V --set-fmt-video=width=2464,height=2058,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=imx264.raw -d /dev/video0
VIDIOC_DQBUF: failed: Input/output error

Format Video Capture:
	Width/Height      : 2464/2058
	Pixel Format      : 'RG12'
	Field             : None
	Bytes per Line    : 5120
	Size Image        : 10536960
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             :

dmesg

[ 1933.750622] imx265 7-0010: imx265_power_on: power on
[ 1933.814269] imx265 7-0010: imx265_s_stream++ enable 1
[ 1933.854186] tegra-vi4 15700000.vi: Status:  4 channel:00 frame:0002
[ 1933.860502] tegra-vi4 15700000.vi:          timestamp sof 1944465974240 eof 1944465983936 data 0x00000200
[ 1933.870155] tegra-vi4 15700000.vi:          capture_id 23 stream  4 vchan  0
[ 1934.850460] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 1935.854467] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout!
[ 1935.860911] imx265 7-0010: imx265_s_stream++ enable 0
[ 1935.898783] imx265 7-0010: imx265_power_off: power off

trace

nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 22/22   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
     kworker/5:0-2653  [005] ...1  1933.850424: rtos_queue_peek_from_isr_failed: tstamp:60763276164 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1933.850432: rtcpu_start: tstamp:60763277630
     kworker/5:0-2653  [005] ...1  1933.902344: rtcpu_vinotify_handle_msg: tstamp:60764555860 tag:CSIMUX_STREAM channel:0xff frame:0 vi_tstamp:635013268 data:0x00010000
     kworker/5:0-2653  [005] ...1  1933.902346: rtcpu_vinotify_handle_msg: tstamp:60764562456 tag:CHANSEL_PXL_SOF channel:0x00 frame:2 vi_tstamp:635019551 data:0x00000001
     kworker/5:0-2653  [005] ...1  1933.902347: rtcpu_vinotify_handle_msg: tstamp:60764562644 tag:ATOMP_FS channel:0x00 frame:2 vi_tstamp:635019556 data:0x00000000
     kworker/5:0-2653  [005] ...1  1933.902348: rtcpu_vinotify_handle_msg: tstamp:60764562780 tag:CHANSEL_FAULT channel:0x00 frame:2 vi_tstamp:635019854 data:0x00000200
     kworker/5:0-2653  [005] ...1  1933.902349: rtcpu_vinotify_handle_msg: tstamp:60764563601 tag:CHANSEL_LOAD_FRAMED channel:0x10 frame:2 vi_tstamp:635020782 data:0x08000000
     kworker/5:0-2653  [005] ...1  1933.902349: rtcpu_vinotify_handle_msg: tstamp:60764563733 tag:CHANSEL_FAULT_FE channel:0x10 frame:2 vi_tstamp:635020808 data:0x00000001
     kworker/5:0-2653  [005] ...1  1933.902350: rtcpu_vinotify_handle_msg: tstamp:60764563906 tag:ATOMP_FE channel:0x00 frame:2 vi_tstamp:635020811 data:0x00000000
     kworker/5:0-2653  [005] ...1  1934.006342: rtos_queue_peek_from_isr_failed: tstamp:60768277050 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1934.162403: rtos_queue_peek_from_isr_failed: tstamp:60773277641 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1934.318400: rtos_queue_peek_from_isr_failed: tstamp:60778278147 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1934.474465: rtos_queue_peek_from_isr_failed: tstamp:60783278716 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1934.630397: rtos_queue_peek_from_isr_failed: tstamp:60788279172 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1934.786400: rtos_queue_peek_from_isr_failed: tstamp:60793279663 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1934.942429: rtos_queue_peek_from_isr_failed: tstamp:60798280199 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1935.098399: rtos_queue_peek_from_isr_failed: tstamp:60803280681 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1935.254394: rtos_queue_peek_from_isr_failed: tstamp:60808281185 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1935.462389: rtos_queue_peek_from_isr_failed: tstamp:60813281694 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1935.618389: rtos_queue_peek_from_isr_failed: tstamp:60818282198 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1935.774374: rtos_queue_peek_from_isr_failed: tstamp:60823282772 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  1935.878827: rtos_queue_peek_from_isr_failed: tstamp:60827270917 queue:0x0b4a3c58

In this way im getting PIXEL_SHORT_LINE error.

kworker/5:0-2653  [005] ...1  1933.902348: rtcpu_vinotify_handle_msg: tstamp:60764562780 tag:CHANSEL_FAULT channel:0x00 frame:2 vi_tstamp:635019854 data:0x00000200

So i changed resolution to 1936x2058 and it looks like it is ok, but image (and video) is broken.

nvidia@tegra-ubuntu:~$ v4l2-ctl -V --set-fmt-video=width=1936,height=2058,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=imx264.raw -d /dev/video0
<
Format Video Capture:
	Width/Height      : 1936/2058
	Pixel Format      : 'RG12'
	Field             : None
	Bytes per Line    : 4096
	Size Image        : 8429568
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             :

dmesg

[ 2910.160020] imx265 7-0010: imx265_power_on: power on
[ 2910.194850] imx265 7-0010: imx265_s_stream++ enable 1
[ 2910.373120] imx265 7-0010: imx265_s_stream++ enable 0
[ 2910.425926] imx265 7-0010: imx265_power_off: power off

trace

kworker/5:0-2653  [005] ...1  2910.199451: rtos_queue_peek_from_isr_failed: tstamp:91275171494 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  2910.199457: rtcpu_start: tstamp:91275172707
     kworker/5:0-2653  [005] ...1  2910.251425: rtcpu_vinotify_handle_msg: tstamp:91276401300 tag:CSIMUX_STREAM channel:0xff frame:0 vi_tstamp:1082087651 data:0x00010000
     kworker/5:0-2653  [005] ...1  2910.251428: rtcpu_vinotify_handle_msg: tstamp:91276407286 tag:CHANSEL_PXL_SOF channel:0x00 frame:2 vi_tstamp:1082093515 data:0x00000001
     kworker/5:0-2653  [005] ...1  2910.251429: rtcpu_vinotify_handle_msg: tstamp:91276407432 tag:ATOMP_FS channel:0x00 frame:2 vi_tstamp:1082093521 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.251430: rtcpu_vinotify_handle_msg: tstamp:91276409587 tag:CHANSEL_LOAD_FRAMED channel:0x10 frame:2 vi_tstamp:1082095960 data:0x08000000
     kworker/5:0-2653  [005] ...1  2910.303478: rtcpu_vinotify_handle_msg: tstamp:91277270002 tag:CHANSEL_PXL_EOF channel:0x00 frame:2 vi_tstamp:1082956089 data:0x08090002
     kworker/5:0-2653  [005] ...1  2910.303484: rtcpu_vinotify_handle_msg: tstamp:91277270142 tag:ATOMP_FE channel:0x00 frame:2 vi_tstamp:1082956204 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.303485: rtcpu_vinotify_handle_msg: tstamp:91277282551 tag:CHANSEL_PXL_SOF channel:0x00 frame:1 vi_tstamp:1082968780 data:0x00000001
     kworker/5:0-2653  [005] ...1  2910.303487: rtcpu_vinotify_handle_msg: tstamp:91277282735 tag:ATOMP_FS channel:0x00 frame:1 vi_tstamp:1082968787 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.303488: rtcpu_vinotify_handle_msg: tstamp:91277284761 tag:CHANSEL_LOAD_FRAMED channel:0x10 frame:1 vi_tstamp:1082971118 data:0x08000000
     kworker/5:0-2653  [005] ...1  2910.303490: rtcpu_vinotify_handle_msg: tstamp:91278145289 tag:CHANSEL_PXL_EOF channel:0x00 frame:1 vi_tstamp:1083831355 data:0x08090002
     kworker/5:0-2653  [005] ...1  2910.303492: rtcpu_vinotify_handle_msg: tstamp:91278145467 tag:ATOMP_FE channel:0x00 frame:1 vi_tstamp:1083831470 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.303493: rtcpu_vinotify_handle_msg: tstamp:91278157847 tag:CHANSEL_PXL_SOF channel:0x00 frame:2 vi_tstamp:1083844046 data:0x00000001
     kworker/5:0-2653  [005] ...1  2910.303495: rtcpu_vinotify_handle_msg: tstamp:91278158076 tag:ATOMP_FS channel:0x00 frame:2 vi_tstamp:1083844053 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.303496: rtcpu_vinotify_handle_msg: tstamp:91278160966 tag:CHANSEL_LOAD_FRAMED channel:0x10 frame:2 vi_tstamp:1083847303 data:0x08000000
     kworker/5:0-2653  [005] ...1  2910.355460: rtcpu_vinotify_handle_msg: tstamp:91279020528 tag:CHANSEL_PXL_EOF channel:0x00 frame:2 vi_tstamp:1084706621 data:0x08090002
     kworker/5:0-2653  [005] ...1  2910.355467: rtcpu_vinotify_handle_msg: tstamp:91279020671 tag:ATOMP_FE channel:0x00 frame:2 vi_tstamp:1084706736 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.355469: rtcpu_vinotify_handle_msg: tstamp:91279033089 tag:CHANSEL_PXL_SOF channel:0x00 frame:1 vi_tstamp:1084719313 data:0x00000001
     kworker/5:0-2653  [005] ...1  2910.355471: rtcpu_vinotify_handle_msg: tstamp:91279033273 tag:ATOMP_FS channel:0x00 frame:1 vi_tstamp:1084719319 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.355472: rtcpu_vinotify_handle_msg: tstamp:91279035961 tag:CHANSEL_LOAD_FRAMED channel:0x10 frame:1 vi_tstamp:1084722318 data:0x08000000
     kworker/5:0-2653  [005] ...1  2910.355474: rtcpu_vinotify_handle_msg: tstamp:91279895773 tag:CHANSEL_PXL_EOF channel:0x00 frame:1 vi_tstamp:1085581887 data:0x08090002
     kworker/5:0-2653  [005] ...1  2910.355476: rtcpu_vinotify_handle_msg: tstamp:91279895876 tag:ATOMP_FE channel:0x00 frame:1 vi_tstamp:1085582002 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.355478: rtcpu_vinotify_handle_msg: tstamp:91279908341 tag:CHANSEL_PXL_SOF channel:0x00 frame:2 vi_tstamp:1085594578 data:0x00000001
     kworker/5:0-2653  [005] ...1  2910.355479: rtcpu_vinotify_handle_msg: tstamp:91279908488 tag:ATOMP_FS channel:0x00 frame:2 vi_tstamp:1085594585 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.355481: rtcpu_vinotify_handle_msg: tstamp:91279912374 tag:CHANSEL_LOAD_FRAMED channel:0x10 frame:2 vi_tstamp:1085598746 data:0x08000000
     kworker/5:0-2653  [005] ...1  2910.355487: rtos_queue_peek_from_isr_failed: tstamp:91280172419 queue:0x0b4a3c58
     kworker/5:0-2653  [005] ...1  2910.407765: rtcpu_vinotify_handle_msg: tstamp:91280771088 tag:CHANSEL_PXL_EOF channel:0x00 frame:2 vi_tstamp:1086457153 data:0x08090002
     kworker/5:0-2653  [005] ...1  2910.407805: rtcpu_vinotify_handle_msg: tstamp:91280771267 tag:ATOMP_FE channel:0x00 frame:2 vi_tstamp:1086457267 data:0x00000000
     kworker/5:0-2653  [005] ...1  2910.407841: rtos_queue_peek_from_isr_failed: tstamp:91280946036 queue:0x0b4a3c58

Looks like Jetson is trying read rg12 format as 2 bytes per pixel.

hello s.bugrov,

you might access Tegra X2 (Parker Series SoC) Technical Reference Manual and refer to [27.10 PIXFMT] chapter for supported input data formats and also RAW data sent to memory formats.

according to Sensor Driver Programming Guide, please check your active_w and active_h properties settings. you should review the sensor specification for the active pixel regions, and you should configure them as pixel-active region.

BTW,
VI engine allocate buffers follow device tree settings.
your tracing log, PIXEL_SHORT_LINE failure means the active region in horizontal direction is less then VI expected.
you might adjust DT settings to verify the results.
thanks

Hello JerryChang,
I tryed change active_w in device tree. v4l2-ctl and gst-launch works with active_w=1936 only.
In data sheet active_w=2464. Images and video with active_w=1936 are corrupted. You can find trace in post#1.

mode0 {/*mode IMX264_MODE*/
  mclk_khz = "37125";
  num_lanes = "4";
  tegra_sinterface = "serial_e";
  discontinuous_clk = "no";
  dpcm_enable = "false";
  cil_settletime = "0";
  dynamic_pixel_bit_depth = "12";
  csi_pixel_bit_depth = "12";
  mode_type = "bayer";
  pixel_phase = "rggb";
				
  active_w = "1936";
  active_h = "2058";
  readout_orientation = "0";
  line_length = "2656";
  inherent_gain = "1";
  mclk_multiplier = "20";
  pix_clk_hz = "198000000";

  min_gain_val = "0"; /* dB */
  max_gain_val = "48"; /* dB */
  step_gain_val = "1"; /* 0.3 */

  min_hdr_ratio = "1";
  max_hdr_ratio = "1";
  min_framerate = "1.5";
  max_framerate = "30";

  min_exp_time = "30";
  max_exp_time = "660000";
  embedded_metadata_height = "0";
};

When i use active_w=2464 i am getting PIXEL_SHORT_LINE. I think the problem in unpackaging csi data. VI creates buffer for every line of size (active_w * pixel_bit_depth)+meta_size. But v4l2-ctl or gst-launch tries read (active_w * (pixel_bit_depth rounded to 2 bytes))+meta_size. So real size of VI line buffer differs from expected.

Tried active_w as in
https://devtalk.nvidia.com/default/topic/1055616/jetson-tx2/configuration-of-imx264-with-mipi-2-lane-for-li-jtx1-mipi-adpt-6cam-on-tx2/post/5354743/#5354743
Same result… PIXEL_SHORT_LINE

hello s.bugrov,

there’re horizontal and vertical signal settings, which using word “line” as horizontal direction, and “frame” as vertical direction.
since PIXEL_SHORT_LINE failure means the active region in horizontal direction is less then VI expected. you’ll need to keep decrease the active_w settings to check the results.
in the other hand, you could also consult with your sensor vendor about the correct signal configuration.
thanks