Hello ShaneCCC
To configure the device resolution I use I2C registers in the lattice, this is working in jetson nano, so if v4l2-ctl, or to be more specific camera_common.c sets the mode, as I understand, to CSI/VI driver, please correct me if I am wrong.
I have seen an error in my kernel tree configuration, the value
use_sensor_mode_id = "true";
has to be “false” in order to the v4l2-ctl or any application that uses VIDIOC_S_FMT to set the correct format specified in the structure.
So now I can see that when I set the format, the camera_common.c is setting the right format, but I still getting the error:
[ 228.803295] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 228.809968] tegra-vi4 15700000.vi: tegra_channel_error_recovery: attempting to reset the capture channel
Here you can see that tegra_channel_capture_setup has the right configuration:
root@beamagine-dev:/sys/kernel/debug/dynamic_debug# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 292/292 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
v4l2-ctl-8028 [004] .... 902.843116: tegra_channel_open: vi-output, bmg_ldr 2-003e
v4l2-ctl-8028 [003] .... 902.845883: tegra_channel_set_power: bmg_ldr 2-003e : 0x1
v4l2-ctl-8028 [003] .... 902.848733: tegra_channel_set_power: 150c0000.nvcsi--1 : 0x1
v4l2-ctl-8028 [003] .... 902.848738: csi_s_power: enable : 0x1
v4l2-ctl-8028 [000] .... 902.852062: tegra_channel_close: vi-output, bmg_ldr 2-003e
v4l2-ctl-8028 [000] .... 902.852078: tegra_channel_set_power: bmg_ldr 2-003e : 0x0
v4l2-ctl-8028 [000] .... 902.855048: tegra_channel_set_power: 150c0000.nvcsi--1 : 0x0
v4l2-ctl-8028 [000] .... 902.855055: csi_s_power: enable : 0x0
v4l2-ctl-8049 [003] .... 909.916895: tegra_channel_open: vi-output, bmg_ldr 2-003e
v4l2-ctl-8049 [003] .... 909.920724: tegra_channel_set_power: bmg_ldr 2-003e : 0x1
v4l2-ctl-8049 [003] .... 909.923907: tegra_channel_set_power: 150c0000.nvcsi--1 : 0x1
v4l2-ctl-8049 [003] .... 909.923945: csi_s_power: enable : 0x1
v4l2-ctl-8049 [004] .... 909.942935: tegra_channel_capture_setup: vnc_id 0 W 14464 H 150 fmt 10
vi-output, bmg_-8050 [003] .... 909.943167: tegra_channel_set_stream: enable : 0x1
kworker/3:0-7900 [003] .... 909.954602: rtos_queue_peek_from_isr_failed: tstamp:28741195709 queue:0x0b4b4500
kworker/3:0-7900 [003] .... 909.954641: rtcpu_start: tstamp:28741198085
kworker/3:0-7900 [003] .... 909.954670: rtos_queue_send_from_isr_failed: tstamp:28741257215 queue:0x0b4a7258
kworker/3:0-7900 [003] .... 909.954675: rtos_queue_send_from_isr_failed: tstamp:28741257355 queue:0x0b4aad68
kworker/3:0-7900 [003] .... 909.954682: rtos_queue_send_from_isr_failed: tstamp:28741257493 queue:0x0b4ac998
kworker/3:0-7900 [003] .... 909.954686: rtos_queue_send_from_isr_failed: tstamp:28741257634 queue:0x0b4ae518
kworker/3:0-7900 [003] .... 909.954694: rtos_queue_send_from_isr_failed: tstamp:28741257775 queue:0x0b4af2d8
kworker/3:0-7900 [003] .... 909.954697: rtos_queue_send_from_isr_failed: tstamp:28741257912 queue:0x0b4b0098
kworker/3:0-7900 [003] .... 909.954706: rtos_queue_send_from_isr_failed: tstamp:28741258050 queue:0x0b4b0e58
kworker/3:0-7900 [003] .... 909.954710: rtos_queue_send_from_isr_failed: tstamp:28741258187 queue:0x0b4b1c18
kworker/3:0-7900 [003] .... 909.954735: rtos_queue_send_failed: tstamp:28741258812 queue:0x0b4a7258
kworker/3:0-7900 [003] .... 909.954739: rtos_queue_send_from_isr_failed: tstamp:28741262936 queue:0x0b4a7258
kworker/3:0-7900 [003] .... 909.954743: rtos_queue_send_from_isr_failed: tstamp:28741263073 queue:0x0b4aad68
kworker/3:0-7900 [003] .... 909.954747: rtos_queue_send_from_isr_failed: tstamp:28741263212 queue:0x0b4ac998
kworker/3:0-7900 [003] .... 909.954751: rtos_queue_send_from_isr_failed: tstamp:28741263351 queue:0x0b4ae518
kworker/3:0-7900 [003] .... 909.954754: rtos_queue_send_from_isr_failed: tstamp:28741263488 queue:0x0b4af2d8
kworker/3:0-7900 [003] .... 909.954758: rtos_queue_send_from_isr_failed: tstamp:28741263626 queue:0x0b4b0098
kworker/3:0-7900 [003] .... 909.954762: rtos_queue_send_from_isr_failed: tstamp:28741263763 queue:0x0b4b0e58
kworker/3:0-7900 [003] .... 909.954766: rtos_queue_send_from_isr_failed: tstamp:28741263899 queue:0x0b4b1c18
kworker/3:0-7900 [003] .... 909.954770: rtos_queue_send_failed: tstamp:28741265338 queue:0x0b4a7258
vi-output, bmg_-8050 [000] .... 909.957919: tegra_channel_set_stream: 150c0000.nvcsi--1 : 0x1
vi-output, bmg_-8050 [000] .... 909.957922: csi_s_stream: enable : 0x1
vi-output, bmg_-8050 [000] .... 909.957947: tegra_channel_set_stream: bmg_ldr 2-003e : 0x1
Here I attach the kernel tree I am using:
in hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-modules/tegra186-camera-bmg-ldr6cam-a00.dtsi
/*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* camera control gpio definitions */
/ {
host1x {
vi@15700000 {
status = "okay";
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status ="okay";
reg = <0>;
bmg_ldr_vi_in0: endpoint {
status = "okay";
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&bmg_ldr_csi_out0>;
};
};
};
};
nvcsi@150c0000 {
status = "okay";
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
status = "okay";
reg = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status = "okay";
reg = <0>;
bmg_ldr_csi_in0: endpoint@0 {
status = "okay";
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&bmg_ldr_out0>;
};
};
port@1 {
status = "okay";
reg = <1>;
bmg_ldr_csi_out0: endpoint@1 {
status = "okay";
remote-endpoint = <&bmg_ldr_vi_in0>;
};
};
};
};
};
};
i2c@3180000 {
status = "okay";
bmg_ldr_a@3e {
status = "okay";
devnode = "video0";
compatible = "beamagine,bmg_ldr";
reg = <0x3e>;
physical_w = "14.408";
physical_h = "200";
sensor_model = "bmg_ldr";
use_sensor_mode_id = "false";
mode0 { //! BMG_LDR_MODE_3664x150_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "3664";
active_h = "150";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "3664";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "5496000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 5.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 5.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "10000000"; //! us
step_exp_time = "1";
default_exp_time = "1000000"; //! us
embedded_metadata_height = "0";
};
mode1 { //! BMG_LDR_MODE_7264x150_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "7264";
active_h = "150";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "7264";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "10896000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 10.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 10.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "1000000"; //! us
step_exp_time = "1";
default_exp_time = "1"; //! us
embedded_metadata_height = "0";
};
mode2 { //! BMG_LDR_MODE_10864x150_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "10864";
active_h = "150";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "10864";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "16296000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 10.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 10.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "1000000"; //! us
step_exp_time = "1";
default_exp_time = "1"; //! us
embedded_metadata_height = "0";
};
mode3 { //! BMG_LDR_MODE_14464x150_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "14464";
active_h = "150";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "14464";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "21696000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 10.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 10.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "1000000"; //! us
step_exp_time = "1";
default_exp_time = "1"; //! us
embedded_metadata_height = "0";
};
mode4 { //! BMG_LDR_MODE_3664x200_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "3664";
active_h = "200";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "3664";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "7328000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 5.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 5.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "10000000"; //! us
step_exp_time = "1";
default_exp_time = "1000000"; //! us
embedded_metadata_height = "0";
};
mode5 { //! BMG_LDR_MODE_7264x200_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "7264";
active_h = "200";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "7264";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "14528000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 10.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 10.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "1000000"; //! us
step_exp_time = "1";
default_exp_time = "1"; //! us
embedded_metadata_height = "0";
};
mode6 { //! BMG_LDR_MODE_10864x200_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "10864";
active_h = "200";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "10864";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "21728000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 10.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 10.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "1000000"; //! us
step_exp_time = "1";
default_exp_time = "1"; //! us
embedded_metadata_height = "0";
};
mode7 { //! BMG_LDR_MODE_14464x200_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "14464";
active_h = "200";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "14464";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*pix_clk_hz = "28928000";*/
/*mclk_multiplier = "29.16";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 10.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 10.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "1000000"; //! us
step_exp_time = "1";
default_exp_time = "1"; //! us
embedded_metadata_height = "0";
};
mode8 { //! BMG_LDR_MODE_11104x150_10FPS
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "11104";
active_h = "150";
mode_type = "bayer";
pixel_phase = "bggr";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "11104";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "83333333";
/*mclk_multiplier = "29.16";*/
/*pix_clk_hz = "16656000";*/
gain_factor = "1";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "0";
max_gain_val = "250";
step_gain_val = "1";
default_gain = "1";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; //! 2.0 fps
max_framerate = "10000000"; //! 10.0 fps
step_framerate = "1";
default_framerate = "10000000"; //! 10.0 fps
min_exp_time = "1000000"; //! us
max_exp_time = "1000000"; //! us
step_exp_time = "1";
default_exp_time = "1"; //! us
embedded_metadata_height = "0";
};
ports {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
port@0 {
status = "okay";
reg = <0>;
bmg_ldr_out0: endpoint {
status = "okay";
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&bmg_ldr_csi_in0>;
};
};
};
};
};
tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
/**
* Physical settings to calculate max ISO BW
*
* num_csi_lanes = <>;
* Total number of CSI lanes when all cameras are active
*
* max_lane_speed = <>;
* Max lane speed in Kbit/s
*
* min_bits_per_pixel = <>;
* Min bits per pixel
*
* vi_peak_byte_per_pixel = <>;
* Max byte per pixel for the VI ISO case
*
* vi_bw_margin_pct = <>;
* Vi bandwidth margin in percentage
*
* max_pixel_rate = <>;
* Max pixel rate in Kpixel/s for the ISP ISO case
*
* isp_peak_byte_per_pixel = <>;
* Max byte per pixel for the ISP ISO case
*
* isp_bw_margin_pct = <>;
* Isp bandwidth margin in percentage
*/
num_csi_lanes = <2>;
max_lane_speed = <1500000>;
min_bits_per_pixel = <10>;
vi_peak_byte_per_pixel = <2>;
vi_bw_margin_pct = <25>;
max_pixel_rate = <240000>;
isp_peak_byte_per_pixel = <5>;
isp_bw_margin_pct = <25>;
/**
* The general guideline for naming badge_info contains 3 parts, and is as follows,
* The first part is the camera_board_id for the module; if the module is in a FFD
* platform, then use the platform name for this part.
* The second part contains the position of the module, ex. “rear” or “front”.
* The third part contains the last 6 characters of a part number which is found
* in the module's specsheet from the vender.
*/
modules {
status = "okay";
module0 {
status = "okay";
badge = "bmg_ldr_0";
position = "front";
orientation = "1";
drivernode0 {
status = "okay";
pcl_id = "v4l2_sensor";
devname = "bmg_ldr 0 2-003e";
proc-device-tree = "/proc/device-tree/host1x/i2c@3180000/bmg_ldr_a@3e";
};
};
};
};
};
in harwdare/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-camera-bmg-ldr6-a00.dtsi
/*
* Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <t18x-common-modules/tegra186-camera-bmg-ldr6cam-a00.dtsi>
#include "dt-bindings/clock/tegra186-clock.h"
#define CAM0_RST_L TEGRA_MAIN_GPIO(R, 5)
#define CAMERA_I2C_MUX_BUS(x) (0x1E + x)
/* camera control gpio definitions */
/ {
i2c@3180000 {
bmg_ldr_a@3e {
/*clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>, */
/* <&tegra_car TEGRA186_CLK_PLLP_OUT0>; */
/*clock-names = "extperiph1", "pllp_grtba";*/
/*mclk = "extperiph1";*/
};
};
};
And in hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3489-0888-a00-00-base.dts
The first lines for the includes are like this:
#include <t18x-common-platforms/tegra186-quill-common-p3489-1000-a00.dtsi>
#include <t18x-common-platforms/tegra186-quill-power-tree-p3489-1000-a00-00.dtsi>
//!#include <t18x-common-platforms/tegra186-quill-camera-modules.dtsi>
#include <t18x-common-platforms/tegra186-quill-camera-bmg-ldr6-a00.dtsi>
#include <t18x-common-modules/tegra186-display-e3320-1000-a00.dtsi>
/* comms dtsi file should be included after gpio dtsi file */
#include <t18x-common-plugin-manager/tegra186-quill-p3489-1000-a00-plugin-manager.dtsi>
#include <t18x-common-modules/tegra186-super-module-e2614-p2597-1000-a00.dtsi>
#include <t18x-common-plugin-manager/tegra186-quill-display-plugin-manager.dtsi>
#include <t18x-common-prod/tegra186-priv-quill-p3489-1000-a00-prod.dtsi>
//!#include <t18x-common-plugin-manager/tegra186-quill-camera-plugin-manager.dtsi>
Is there any difference in developing a driver for the jetson nano and the TX2 regarding the Kernel tree configuration?
Thank you