Modify Camera driver resolution from 3848x2168 to 1920x1080

Hi all,

Environment :

Board : Jetson AGX Xavier
JetPack : 4.3

We’ve developed a driver for our MIPI-CSI GMSL2 custom camera using an AR0820 as an image sensor, this latter has a resolution of 8 Mpx (3848x2168), we’re able to capture properly with this resolution, but when we set the resolution to 2 Mpx (1920x1080), we have too many glitches during the capture with nvarguscamerasrc

The description below use 8 Mpx (3848x2168) as a resolution

mode0 {/*mode AR0820_MODE_3848X2168_CROP_30FPS*/
					mclk_khz = "24000";
					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 = "grbg";

					active_w = "3848";
					active_h = "2168";
					readout_orientation = "0";
					line_length = "4440";
					inherent_gain = "1";
					mclk_multiplier = "14.58";
					pix_clk_hz = "296236800";
					serdes_pix_clk_hz = "833333333";

					gain_factor = "1";
					min_gain_val = "1";
					max_gain_val = "15";
					step_gain_val = "1";
					default_gain = "1";
					min_hdr_ratio = "1";
					max_hdr_ratio = "1";
					framerate_factor = "1000000";
					min_framerate = "30000000";
					max_framerate = "30000000";
					step_framerate = "1";
					default_framerate ="30000000";
					exposure_factor ="1000000";
					min_exp_time = "15";
					max_exp_time = "33333";
					step_exp_time = "1";
					default_exp_time = "5454";

					embedded_metadata_height = "0";
				};

I set the new resolution 1920x1080 to be able to capture 2 Mpx as the following

mode0 {/*mode AR0820_MODE_1920X1080_CROP_30FPS*/
					mclk_khz = "24000";
					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 = "grbg";

					active_w = "1920";
					active_h = "1080";
					readout_orientation = "0";
					line_length = "4440";
					inherent_gain = "1";
					mclk_multiplier = "14.58";
					pix_clk_hz = "296236800";
					serdes_pix_clk_hz = "833333333";

					gain_factor = "1";
					min_gain_val = "1";
					max_gain_val = "15";
					step_gain_val = "1";
					default_gain = "1";
					min_hdr_ratio = "1";
					max_hdr_ratio = "1";
					framerate_factor = "1000000";
					min_framerate = "30000000";
					max_framerate = "30000000";
					step_framerate = "1";
					default_framerate ="30000000";
					exposure_factor ="1000000";
					min_exp_time = "15";
					max_exp_time = "33333";
					step_exp_time = "1";
					default_exp_time = "5454";

					embedded_metadata_height = "0";
				};

Is there other paramters that must be edited to get the 2 Mpx without glitches ?

Thanks.

Did you add corresponding sensor mode(1080p) in sensor driver?

@ShaneCCC Can you give an example in another sensor driver where to add the sensor model please ?

You can reference to …/kernel/nvidia/drivers/media/i2c/ov5693.c ov5693_mode_tbls.h

HI @ShaneCCC,

Thank you for the support, i’ve seen that there is different sensor modes (resolution) according to the register values in the tables, i have the datasheet of the AR0820, but i’ve only the register table for 3840x2160, can you please suggest documentation in where can i find the register value for AR0820 1920x1080 resolution ?

Sorry, can’t help on it.
Please get the datasheet from sensor vendor.

Thanks

Hi @ShaneCCC

I find the register in where to use the wanted resolution, so i implemented a the sensor mode 1920x1080, but it does a croping of an image (It takes only 1920x1080 of 3840x2160), i want only to capture a resized image from 3840x2160, is that theoretically possible ? Is there any way to have a resized image ?

Thanks

Not sure if using nvvidconv to crop to 1080p match your request?

@ShaneCCC I want to capture 3848x2168 and resize to 1920x1080 and avoid doing a crop because i need the whole image

OK, the aspect ratio of your request is the same then nvvidconv do the downscale to 1080P

@ShaneCCC I want to do a binning to 1080p like it shown in the picture below despite of the cropping

binning-example-1

For the binning configuration you need consult with sensor vendor to get the REG configuration to implement new sensor mode.

Thanks