Received Raw12 data has several black horizon line. Check Device Tree Setting

Hi everyone,

I’m developing on Jetson AGX Xavier.
And I try to receive 5000x5000 raw12 image which is all white via D-PHYx2Lane.
When I receive image and show at ImageJ find the image has several black horizon line see at attachment.
I want to check my device tree seeting is correct or not.

Below is my device tree setting.

			mode0 { // OV5693_MODE_2592X1944
				mclk_khz = "37125";//?
				num_lanes = "2";//?
				tegra_sinterface = "serial_e";//?
				phy_mode = "DPHY";//?
				discontinuous_clk = "no";//?
				dpcm_enable = "false";//?
				cil_settletime = "0";//?

				active_w = "2592";//
				active_h = "1944";//
				mode_type = "bayer";
				pixel_phase = "bggr";//?
 				//dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";//The sensor readout pixel pattern
				readout_orientation = "0";//
				line_length = "2200";//
				inherent_gain = "1";//
				mclk_multiplier = "2";//
				pix_clk_hz = "74250000";//

				gain_factor = "10";
				min_gain_val = "0";//
				max_gain_val = "720";//
				step_gain_val = "3";
				default_gain = "0";
				min_hdr_ratio = "1";//
				max_hdr_ratio = "1";//
				framerate_factor = "1000000";
				min_framerate = "2000000";//
				max_framerate = "30000000";//
				step_framerate = "1";
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "30";//
				max_exp_time = "660000";//
				step_exp_time = "1";
				default_exp_time = "33334";
				embedded_metadata_height = "0";//?

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					e3326_ov5693_out0: endpoint {
						port-index = <4>;
						bus-width = <2>;
						remote-endpoint = <&e3326_csi_in0>;

I serach some dtsi files find usually set line_length > active_w

How line_length should be setten?
save_5000x5000_dt_sensd2592x1944.raw (47.7 MB)

hello syan,

I believe you’re refer to OV5693’s device tree to implement your own driver, right?
you may see Sensor Software Driver Programming to adapt the device tree settings to your sensor driver.

Hi Jerry,
I check my device tree’sline_length is setting 2200
And Document says:

Pixel line width horizontal timing size for the sensor mode. Used to calibrate the features in the camera stack.
The value must be greater than or equal to active_w.

So I change line width from 2200 to 6600 which is more than active_w(2592) and received Image’s width(5000).

But It seem had some question, the recived Raw12 data has several black horizon line…

Also, I modify the vi5_formats.h to modify the T_R16 to T_R16_I.
The Received data from
ff ff ff ff…
ff 7f ff 7f…

Does it right?

lineLength6600_ff7f_Xavier_test.raw (47.7 MB)

hello syan,

please configure active_w/active_h as 5000 since you’d camera sensor that output the image resolution with 5000x5000.
the line_length settings is depends-on the register configuration, please dig into initial table for the values.

BTW, Xavier series are default using T_R16, it is a 16-bit unsigned word format, packing two per 32-bit word.

Sure, I configure active_w/active_h as 5000. But It still has same problom.

According to

I want to FF FF … to FF 0F
So I modify vi5_formats.h file to modify the T_R16 to T_R16_I.

please access V4L2 Sensor Driver Development Tutorial to bring-up your sensor driver.

Hi Jerry,
This tutorial is helped me a lot.
Now I can recevie 2592x1944 RAW12 all white image without black horizon lines.
Then I try to recevie 5000x5000 RAW12 all white image in same way.
It still shows some black horizon lines.

I search about Xavier max receive resolution (Maximum camera resolution when live-capturing/encoding in H.265 with CSI-MIPI camera on Jetson AGX)

So I test 4000x3000, and it’s as normal as 2592x1944.

Does it possible when I receive 5000x5000 with black horizon lines is Xavier resolution limit?

hello syan,

we should have follow VI’s 64 byte aligned to set the correct stride, set the width alignment to 64.
you have have a try to use v4l2-ctl command to adjust the stride by --preferred_stride=<>.

Hi Jerry,
Sure. I use command v4l2-ctl --set-ctrl preferred_stride=64 to adjust the stride.
Then I check setting is modify or not by v4l2-ctl --all

I test receiving 5000x5000 again.
It still has same problem…

0128_test_5000x5000.raw (47.7 MB)

hello syan,

you’re only dump the raw, right? this resolution is not a limitation if you’re using the v4l2-ctl to fetch the raw files.
FYI, the max resolution though ISP is 24-Mega pixels, and the max supported line buffer is 6144.

I’ve check the raw file, they’re some data in the head, and 0xFF for the contents.
I did not see black horizon lines you’ve mentioned.

Hi Jerry,

Thanks for your information about max resolution.
The 0128_test_5000x5000.raw is Xavier fetch the raw files by v4l2-ctl.

When I use ImageJ to check the raw file, the black horizon lines I say occur both side.(first line is header x=0~7,y=0)
Also, I use HxD double check it, it still have that.
Just at attachment.

When I use command
v4l2-ctl --device /dev/video0 --set-fmt-video=width=5000,height=5000,pixelformat=’RG12’ --stream-mmap --stream-to=0207.raw --stream-count=1
The black horizon lines only occur right side.
0207.raw (47.7 MB)

hello syan,

please have a try to configure bypass_mode=0 for verification,
i.e. $ v4l2-ctl -d /dev/video0 --set-fmt-video=width=5000,height=5000,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw

Hi Jerry,
I have tried $ v4l2-ctl -d /dev/video0 --set-fmt-video=width=5000,height=5000,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw
And it is the same occur right side only. (63.7 KB)

hello syan,

may I know which sensor module it is, what’s the active region it supported.

Hi Jerry,

I modify ov5693_mode_tbls.h to change resolution size by this tutorial.

hello syan,

what’s the camera sensor it is.
are you using ov5693 and hacking the mode table to pretend it outputting 5K*5K?

Hi Jerry,
Yes. I’m using ov5693.
And modify ov5693_mode_tbls.h this file to output 5000*5000