Hi folks,
we are porting a driver from the NVIDIA Jetson Nano Platform (using the Development Kit B) to the Jetson Orin NX running in an Seeed-Studio J401 Carrier Board.
At the moment the Camera gets detected by the driver and is available as /dev/video0 and we are able to take pictures via “v4l2-ctl”. The problem is, that those pictures just do not look right:
Expected result:
Actual result (sensor not covered):
Actual result (Sensor covered with Hand):
We do think that it might be a clock problem, but we do not know how to set the clocks properly. In the NVIDIA Jetson Nano DTB the clocks are set as followed:
DTB of Jetson Nano (not 100% sure why cam_i2cmux and i2c@0 are disabled, but it is working):
cam_i2cmux {
compatible = "i2c-mux-gpio";
#address-cells = <0x01>;
#size-cells = <0x00>;
mux-gpios = <0x5b 0x40 0x00>;
i2c-parent = <0xad>;
status = "disabled";
linux,phandle = <0xcb>;
phandle = <0xcb>;
i2c@0 {
status = "disabled";
reg = <0x00>;
#address-cells = <0x01>;
#size-cells = <0x00>;
linux,phandle = <0xcc>;
phandle = <0xcc>;
imx485_a@1a {
compatible = "test,imx485";
reg = <0x1a>;
devnode = "video0";
physical_w = "20.00";
physical_h = "16.80";
sensor_model = "imx485";
post_crop_frame_drop = [30 00];
use_decibel_gain = "true";
delayed_gain = "false";
use_sensor_mode_id = "false";
clocks = <0x26 0x117>;
clock-names = "clk_out_3";
mclk = "clk_out_3";
clock-frequency = <0x2367b88>;
reset-gpios = <0x5b 0x97 0x00>;
linux,phandle = <0x12c>;
phandle = <0x12c>;
mode0 {
mclk_khz = "37125";
num_lanes = [32 00];
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = [30 00];
active_w = "3864";
active_h = "2180";
dynamic_pixel_bit_depth = "12";
csi_pixel_bit_depth = "12";
mode_type = "bayer";
pixel_phase = "rggb";
readout_orientation = [30 00];
line_length = "6600";
inherent_gain = [31 00];
mclk_multiplier = "20.48";
pix_clk_hz = "760000000";
gain_factor = "10";
min_gain_val = [30 00];
max_gain_val = "720";
step_gain_val = [33 00];
default_gain = [30 00];
min_hdr_ratio = [31 00];
max_hdr_ratio = "64";
framerate_factor = "1000000";
min_framerate = "1500000";
max_framerate = "32000000";
step_framerate = [31 00];
default_framerate = "30000000";
exposure_factor = "1000000";
min_exp_time = "27";
max_exp_time = "660000";
step_exp_time = [31 00];
default_exp_time = "10000";
embedded_metadata_height = [31 00];
};
mode1 {
mclk_khz = "37125";
num_lanes = [32 00];
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = [30 00];
active_w = "1920";
active_h = "1080";
dynamic_pixel_bit_depth = "12";
csi_pixel_bit_depth = "12";
mode_type = "bayer";
pixel_phase = "rggb";
readout_orientation = [30 00];
line_length = "6600";
inherent_gain = [31 00];
mclk_multiplier = "20.48";
pix_clk_hz = "760000000";
gain_factor = "10";
min_gain_val = [30 00];
max_gain_val = "720";
step_gain_val = [33 00];
default_gain = [30 00];
min_hdr_ratio = [31 00];
max_hdr_ratio = "64";
framerate_factor = "1000000";
min_framerate = "1500000";
max_framerate = "63000000";
step_framerate = [31 00];
default_framerate = "60000000";
exposure_factor = "1000000";
min_exp_time = "27";
max_exp_time = "660000";
step_exp_time = [31 00];
default_exp_time = "10000";
embedded_metadata_height = [31 00];
};
ports {
#address-cells = <0x01>;
#size-cells = <0x00>;
port@0 {
reg = <0x00>;
endpoint {
port-index = <0x00>;
bus-width = <0x02>;
remote-endpoint = <0x78>;
linux,phandle = <0x79>;
phandle = <0x79>;
};
};
};
};
DTB of Jetson Orin NX:
cam_i2cmux {
compatible = "i2c-mux-gpio";
#address-cells = <0x01>;
#size-cells = <0x00>;
mux-gpios = <0x64 0x13 0x00>;
i2c-parent = <0x2bf>;
status = "okay";
i2c@0 {
reg = <0x00>;
#address-cells = <0x01>;
#size-cells = <0x00>;
status = "okay";
phandle = <0x488>;
imx485_a@1a {
status = "okay";
compatible = "test,imx485";
reg = <0x1a>;
devnode = "video0";
physical_w = "20.00";
physical_h = "16.80";
sensor_model = "imx485";
post_crop_frame_drop = [30 00];
use_decibel_gain = "true";
delayed_gain = "false";
use_sensor_mode_id = "false";
reset-gpios = <0x05 0x3e 0x00>;
phandle = <0x489>;
mode0 {
mclk_khz = "37125";
num_lanes = [32 00];
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = [30 00];
dynamic_pixel_bit_depth = "12";
csi_pixel_bit_depth = "12";
mode_type = "bayer";
pixel_phase = "rggb";
active_w = "3840";
active_h = "2160";
readout_orientation = [30 00];
line_length = "988";
inherent_gain = [31 00];
mclk_multiplier = "7.37";
pix_clk_hz = "273715200";
gain_factor = "1";
min_gain_val = [30 00];
max_gain_val = "300";
step_gain_val = [33 00];
default_gain = [30 00];
min_hdr_ratio = [31 00];
max_hdr_ratio = [31 00];
framerate_factor = "1000000";
min_framerate = "2500000";
max_framerate = "33000000";
step_framerate = [31 00];
default_framerate = "33000000";
exposure_factor = "1000000";
min_exp_time = "450";
max_exp_time = "400000";
step_exp_time = [31 00];
default_exp_time = "16667";
embedded_metadata_height = [31 00];
};
mode1 {
mclk_khz = "37125";
num_lanes = [32 00];
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = [30 00];
active_w = "1920";
active_h = "1080";
dynamic_pixel_bit_depth = "12";
csi_pixel_bit_depth = "12";
mode_type = "bayer";
pixel_phase = "rggb";
readout_orientation = [30 00];
line_length = "6600";
inherent_gain = [31 00];
mclk_multiplier = "20.48";
pix_clk_hz = "760000000";
gain_factor = "10";
min_gain_val = [30 00];
max_gain_val = "720";
step_gain_val = [33 00];
default_gain = [30 00];
min_hdr_ratio = [31 00];
max_hdr_ratio = "64";
framerate_factor = "1000000";
min_framerate = "1500000";
max_framerate = "63000000";
step_framerate = [31 00];
default_framerate = "60000000";
exposure_factor = "1000000";
min_exp_time = "27";
max_exp_time = "660000";
step_exp_time = [31 00];
default_exp_time = "10000";
embedded_metadata_height = [31 00];
};
ports {
#address-cells = <0x01>;
#size-cells = <0x00>;
port@0 {
reg = <0x00>;
endpoint {
port-index = <0x00>;
bus-width = <0x02>;
remote-endpoint = <0x2c0>;
phandle = <0x48a>;
};
};
};
};
If we add the entries:
clocks = <0x26 0x117>;
clock-names = "clk_out_3";
mclk = "clk_out_3";
clock-frequency = <0x2367b88>;
from the Jetson DTB to the Orin DTB the camera does not work at all anymore and the Driver gives me the following errors in dmesg:
[ 10.937334] imx485: loading out-of-tree module taints kernel.
[ 10.948847] imx485 9-001a: probing v4l2 sensor at addr 0x1a
[ 10.948901] imx485 9-001a: imx485_parse_dt: Parse dtb
[ 10.954198] imx485 9-001a: avdd, iovdd and/or dvdd reglrs. not present, assume sensor powered independently
[ 10.954208] OF: /cam_i2cmux/i2c@0/imx485_a@1a: could not get #clock-cells for /thermal-zones/SOC2-therm/trips/soc2-sw-throttle
[ 10.965939] imx485 9-001a: unable to get clock clk_out_3
[ 10.971399] imx485 9-001a: unable to power get
[ 10.975961] imx485 9-001a: tegra camera driver registration failed
[ 10.982522] imx485: probe of 9-001a failed with error -14
dmesg output on Jetson Nano for comparison:
[ 6.093097] imx485: loading out-of-tree module taints kernel.
[ 6.093797] imx485 7-001a: imx485_parse_dt: Parse dtb
[ 6.094015] imx485 7-001a: tegracam sensor driver:imx485_v2.0.6
[ 6.395884] imx485 7-001a: imx485_power_off: power off
[ 6.397011] vi 54080000.vi: subdev imx485 7-001a bound
Im quite confident, that the camera will work after adding the correct clocks, but i don’t now which clocks to use on the Orin.
Any help would be greatly appreciated!