IMX185 All-pixel Scan Mode not working

Hi,
I try to implement the all-pixel scan mode (25Hz) of the Sony IMX185. I changed the registers as it is described in the sensor data sheet and also adapted the mode entry in the device tree:

mode0 {/*mode IMX185_MODE_1920X1200_CROP_25FPS*/
	mclk_khz = "37125";
	num_lanes = "4";
	tegra_sinterface = "serial_a";
	phy_mode = "DPHY";
	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 = "1952";
	active_h = "1241";
	readout_orientation = "0";
	line_length = "2250";
	inherent_gain = "1";
	mclk_multiplier = "2";
	pix_clk_hz = "74250000";

	gain_factor = "10";
	min_gain_val = "0"; /* 0dB */
	max_gain_val = "480"; /* 48dB */
	step_gain_val = "3"; /* 0.3 */
	default_gain = "0";
	min_hdr_ratio = "1";
	max_hdr_ratio = "1";
	framerate_factor = "1000000";
	min_framerate = "1500000"; /* 1.5 */
	max_framerate = "25000000"; /* 25 */
	step_framerate = "1";
	default_framerate = "25000000";
	exposure_factor = "1000000";
	min_exp_time = "30"; /* us */
	max_exp_time = "660000"; /* us */
	step_exp_time = "1";
	default_exp_time = "33334";/* us */
	embedded_metadata_height = "1";
};

When I try to capture an image, I get the following output in the trace:

v4l2-ctl-8664  [004] ....   136.145823: tegra_channel_open: vi-output, imx185 32-001a
        v4l2-ctl-8664  [004] ....   136.146853: tegra_channel_set_power: imx185 32-001a : 0x1
        v4l2-ctl-8664  [004] ....   136.146862: camera_common_s_power: status : 0x1
        v4l2-ctl-8664  [004] ....   136.147372: tegra_channel_set_power: 150c0000.nvcsi--1 : 0x1
        v4l2-ctl-8664  [004] ....   136.147375: csi_s_power: enable : 0x1
        v4l2-ctl-8664  [003] ....   136.158048: tegra_channel_capture_setup: vnc_id 0 W 1952 H 1241 fmt 20
 vi-output, imx1-8665  [005] ....   136.158158: tegra_channel_set_stream: enable : 0x1
 vi-output, imx1-8665  [004] ....   136.164444: tegra_channel_set_stream: 150c0000.nvcsi--1 : 0x1
 vi-output, imx1-8665  [004] ....   136.164448: csi_s_stream: enable : 0x1
 vi-output, imx1-8665  [004] ....   136.164484: tegra_channel_set_stream: imx185 32-001a : 0x1
     kworker/5:2-3068  [005] ....   136.181901: rtos_queue_peek_from_isr_failed: tstamp:4646354314 queue:0x0b4b4500
     kworker/5:2-3068  [005] ....   136.181906: rtcpu_start: tstamp:4646355416
     kworker/5:2-3068  [005] ....   136.181908: rtos_queue_send_from_isr_failed: tstamp:4646363885 queue:0x0b4a7258
     kworker/5:2-3068  [005] ....   136.181909: rtos_queue_send_from_isr_failed: tstamp:4646364003 queue:0x0b4aad68
     kworker/5:2-3068  [005] ....   136.181910: rtos_queue_send_from_isr_failed: tstamp:4646364109 queue:0x0b4ac998
     kworker/5:2-3068  [005] ....   136.181911: rtos_queue_send_from_isr_failed: tstamp:4646364218 queue:0x0b4ae518
     kworker/5:2-3068  [005] ....   136.181912: rtos_queue_send_from_isr_failed: tstamp:4646364323 queue:0x0b4af2d8
     kworker/5:2-3068  [005] ....   136.181913: rtos_queue_send_from_isr_failed: tstamp:4646364428 queue:0x0b4b0098
     kworker/5:2-3068  [005] ....   136.181914: rtos_queue_send_from_isr_failed: tstamp:4646364533 queue:0x0b4b0e58
     kworker/5:2-3068  [005] ....   136.181915: rtos_queue_send_from_isr_failed: tstamp:4646364638 queue:0x0b4b1c18
     kworker/5:2-3068  [005] ....   136.181916: rtos_queue_send_failed: tstamp:4646365101 queue:0x0b4a7258
     kworker/5:2-3068  [005] ....   136.181917: rtos_queue_send_from_isr_failed: tstamp:4646367460 queue:0x0b4a7258
     kworker/5:2-3068  [005] ....   136.181918: rtos_queue_send_from_isr_failed: tstamp:4646367566 queue:0x0b4aad68
     kworker/5:2-3068  [005] ....   136.181919: rtos_queue_send_from_isr_failed: tstamp:4646367672 queue:0x0b4ac998
     kworker/5:2-3068  [005] ....   136.181920: rtos_queue_send_from_isr_failed: tstamp:4646367778 queue:0x0b4ae518
     kworker/5:2-3068  [005] ....   136.181920: rtos_queue_send_from_isr_failed: tstamp:4646367881 queue:0x0b4af2d8
     kworker/5:2-3068  [005] ....   136.181921: rtos_queue_send_from_isr_failed: tstamp:4646367986 queue:0x0b4b0098
     kworker/5:2-3068  [005] ....   136.181922: rtos_queue_send_from_isr_failed: tstamp:4646368091 queue:0x0b4b0e58
     kworker/5:2-3068  [005] ....   136.181923: rtos_queue_send_from_isr_failed: tstamp:4646368195 queue:0x0b4b1c18
     kworker/5:2-3068  [005] ....   136.181924: rtos_queue_send_failed: tstamp:4646369138 queue:0x0b4a7258
     kworker/5:2-3068  [005] ....   136.294052: rtcpu_vinotify_event: tstamp:4650249975 tag:CSIMUX_FRAME channel:0x00 frame:1 vi_tstamp:4650249124 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.350011: rtos_queue_peek_from_isr_failed: tstamp:4651354893 queue:0x0b4b4500
     kworker/5:2-3068  [005] ....   136.350025: rtcpu_vinotify_event: tstamp:4651500887 tag:CSIMUX_FRAME channel:0x00 frame:2 vi_tstamp:4651500275 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.406005: rtcpu_vinotify_event: tstamp:4652752035 tag:CSIMUX_FRAME channel:0x00 frame:3 vi_tstamp:4652751426 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.406014: rtcpu_vinotify_event: tstamp:4654003182 tag:CSIMUX_FRAME channel:0x00 frame:4 vi_tstamp:4654002577 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.462002: rtcpu_vinotify_event: tstamp:4655254338 tag:CSIMUX_FRAME channel:0x00 frame:5 vi_tstamp:4655253728 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.518008: rtos_queue_peek_from_isr_failed: tstamp:4656354897 queue:0x0b4b4500
     kworker/5:2-3068  [005] ....   136.518016: rtcpu_vinotify_event: tstamp:4656505486 tag:CSIMUX_FRAME channel:0x00 frame:6 vi_tstamp:4656504877 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.574050: rtcpu_vinotify_event: tstamp:4657756977 tag:CSIMUX_FRAME channel:0x00 frame:7 vi_tstamp:4657756028 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.574056: rtcpu_vinotify_event: tstamp:4657757496 tag:CHANSEL_SHORT_FRAME channel:0x10 frame:7 vi_tstamp:4657756028 data:0x00000001
     kworker/5:2-3068  [005] ....   136.574061: rtcpu_vinotify_event: tstamp:4657757994 tag:ATOMP_FE channel:0x00 frame:7 vi_tstamp:4657756032 data:0x00000001
     kworker/5:2-3068  [005] ....   136.574066: rtcpu_vinotify_event: tstamp:4659007803 tag:CSIMUX_FRAME channel:0x00 frame:8 vi_tstamp:4659007179 data:0x000000a4
     kworker/5:2-3068  [005] ....   136.630029: rtcpu_vinotify_event: tstamp:4660258938 tag:CSIMUX_FRAME channel:0x00 frame:9 vi_tstamp:4660258330 data:0x000000a4
 vi-output, imx1-8665  [003] ....   136.672477: tegra_channel_capture_setup: vnc_id 0 W 1952 H 1241 fmt 20
 vi-output, imx1-8665  [003] ....   136.672526: tegra_channel_capture_frame: sof:-549620695332.-268696506048
     kworker/5:2-3068  [005] ....   136.686069: rtos_queue_peek_from_isr_failed: tstamp:4661354904 queue:0x0b4b4500
     kworker/5:2-3068  [005] ....   136.686086: rtcpu_vinotify_event: tstamp:4661510089 tag:CSIMUX_FRAME channel:0x00 frame:10 vi_tstamp:4661509480 data:0x000000a4

One can see the CHANSEL_SHORT_FRAME error. Regarding to similar topics in this forum, it seems to be an issue with the active_h. I set it to 1241 because this is the total number of pixels as written in the data sheet. I also tried different sizes but unfortunately, I can not get it to work. Maybe someone has an idea what I could try further? I would appreciate if someone could help me to solve this issue.

Thanks,
Markus

hello MarkusHeß,

couple of suggestions as below,

  1. you should modify the active_h = “1241”; since video input engine did not support resolution in the odd values.

  2. suppose you’ll need to update the pixel clock for all-pixel scan mode,
    please check [Sensor Pixel Clock] session in the Sensor Driver Programming Guide for the calculation formulas.

Hi JerryChang,

I tried it with 1240 and 1242 with no success. I’m not sure if this value is correct. Regarding the sensor datasheet, the image has the following structure in vertical direction:

FS
   1 line(s) - Embedded data
   1 line(s) - NULL0
  14 line(s) - VOB
   4 line(s) - NULL1
   8 line(s) - margin for color processing
1200 line(s) - recording area
   9 line(s) - margin for color processing
   4 line(s) - NULL2
FE
VBLANK

So, the sensor should output 1241 lines between FS and FE, am I right? Because the video input engine does not support odd values, I would use the next even value - 1242. Is my assumption correct?

Is it somehow possible to get the number of lines that the video input engine received from the sensor to check if the sensor is configured correctly?

I calculated the pixel clock using these formulas and it should be correct.

Do you have any further idea for debugging this issue?

Thanks!

hello MarkusHeß,

device tree properties active_w and active_h specifies the resolution of the pixel active regions.
hence, please configure the properties following below.

  1. you should exclude embedded metadata line, there’s another property to specify the value.
  2. please ignored the area of optical black and also some unused effective margin.

suggest you also refer to 1080p pixel array in sensor datasheet and check the default device tree settings.
thanks

Ok, I ignored the margin and set active_w and active_h to 1920 and 1200 but still get the CHANSEL_SHORT_FRAME message. The property embedded_metadata_height is set to 1.

In the default device tree, they set the active_w/h to 1920x1080, so in my case 1920x1200 should be ok? I also adjusted the line length according to the datasheet (2200 for 1080p, 2250 for all-pixel). Nothing helped, I’m still getting the CHANSEL_SHORT_FRAME error.

Is there any way to get a more detailed description about the CHANSEL_SHORT_FRAME error? Maybe it is possible to see how many lines were received?

Just to be sure:
The resolution given in imx185_frmfmt struct of the sensor driver must match the active_w/h in the device tree, right?

hello MarkusHeß,

VI engine allocate capture buffer according to your device tree settings, CHANSEL_SHORT_FRAME error report means the number of vertical pixels were less than expected.

however,
you should consult with your sensor vendor to ensure the sensor init register settings were all-pixel scan mode.
thanks