I would like to know how to calculate the correct pix_clk_hz setting in the device tree.
See below for details.
In the application we are developing, the adv7481’s CSI-2 output is connected to the Xavier nx’s CSI-2 input. D-PHY x 4 lanes are used. The data format is YUV 8-bit.
First of all, as an experiment, I tried transferring some images from the adv7481 to xavier at 1280*720p (50FPS), and there was no problem to capture the images. (The ADV7481 register’s set on SDR mode). The device tree and setting value at this time was :
mode0 { // ADV7481_MODE_1280x720_50FPS_4LANES
mclk_khz = “74250”;
num_lanes = “4”;
tegra_sinterface = “serial_a”;
phy_mode = “DPHY”;
discontinuous_clk = “yes”;
dpcm_enable = “false”;
cil_settletime = “0”;
active_w = “1280”;
active_h = “720”;
mode_type = "yuv";
pixel_phase = "uyvy";
csi_pixel_bit_depth = "8";
pixel_t = "yuv_uyvy16";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "4";
pix_clk_hz = "297000000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16";
max_gain_val = "170";
step_gain_val = "1";
default_gain = "16";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "1500000";
max_framerate = "120000000";
step_framerate = "1";
default_framerate = "50000000";
min_exp_time = "13";
max_exp_time = "683709";
step_exp_time = "1";
default_exp_time = "2495";
embedded_metadata_height = "0";
};
Then I changed the camera input resplution to 1920*1080p (30FPS), and there was no problem to capture the images. (The ADV7481 register’s set on SDR mode). The device tree and setting value at this time was :
mode1 { // ADV7481_MODE_1920x1080_30FPS_4LANES
mclk_khz = “74250”;
num_lanes = “4”;
tegra_sinterface = “serial_a”;
phy_mode = “DPHY”;
discontinuous_clk = “yes”;
dpcm_enable = “false”;
cil_settletime = “0”;
active_w = "1920";
active_h = "1080";
mode_type = "yuv";
pixel_phase = "uyvy";
csi_pixel_bit_depth = "8";
pixel_t = "yuv_uyvy16";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "4";
pix_clk_hz = "297000000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16";
max_gain_val = "170";
step_gain_val = "1";
default_gain = "16";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "1500000";
max_framerate = "120000000";
step_framerate = "1";
default_framerate = "30000000";
min_exp_time = "13";
max_exp_time = "683709";
step_exp_time = "1";
default_exp_time = "2495";
embedded_metadata_height = "0";
};
finally I want to have the camera input resolution 1920*1080(50FPS), and could not capture the images with any setting of device tree. (The ADV7481 register’s set on SDR mode). The device tree and setting value at this time was :
mode2 { // ADV7481_MODE_1920x1080_50FPS_4LANES
mclk_khz = “148500”;
num_lanes = “4”;
tegra_sinterface = “serial_a”;
phy_mode = “DPHY”;
discontinuous_clk = “yes”;
dpcm_enable = “false”;
cil_settletime = “0”;
active_w = “1920”;
active_h = “1080”;
mode_type = "yuv";
pixel_phase = "uyvy";
csi_pixel_bit_depth = "8";
pixel_t = "yuv_uyvy16";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "4";
pix_clk_hz = "594000000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16";
max_gain_val = "170";
step_gain_val = "1";
default_gain = "16";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "1500000";
max_framerate = "120000000";
step_framerate = "1";
default_framerate = "50000000";
min_exp_time = "13";
max_exp_time = "683709";
step_exp_time = "1";
default_exp_time = "2495";
embedded_metadata_height = "0";
};
I tried the following settings but none of them were successful:
• I test the changed the pix_clk_hz setting value to 1250000000. (xavier nx series : 14 lanes - 2.5 Gb/s per pair, total up to 30 Gbps)
pixel_clk_hz = sensor data rate per lane (Mbps) * number of lanes / bits per pixel
pixel_clk_hz = (2.500.000.000 / 8 )* 4 = 1.250.000.000 bps
• I test the changed the pix_clk_hz setting value to 1250000000. ( sensor output size =22001125 )
pixel_clk_hz = sensor output size × frame rate
pixel_clk_hz = (22001125 )* 50= 123.750.000 bps
• I changed the ADV7481 register’s to DDR mode.
Which part am I doing wrong?
Thank you in advance for your cooperation.