I’m currently trying to use a 5M RGB-IR camera.
The image sensor I am using is VB1940, which has an ISP inside and outputs RGB-IR raw 12bit.
To use this, how do I set the pixel format in the devicetree and driver code?
Current don’t support RGB-IR sensor. Maybe you can try convert to YUV by ISP than output to Orin.
Currently, while printing to YUV, an error appears in the trace log as shown in the attached file. How do I solve this?
tracelog.txt (52.5 KB)
Below is my devicetree configuration.
max96724@3 {
compatible = "nvidia,max96724";
status = "okay";
devnode = "video2";
reg = <0x03>;
physical_w = "15.0";
physical_h = "12.5";
reset-gpios = <0x04 0x3b 0x00>;
sensor_model = "max96724b";
post_crop_frame_drop = [30 00];
use_decibel_gain = "false";
use_sensor_mode_id = "false";
clocks = <0x02 0x24 0x02 0x24>;
clock-names = "extperiph1\0pllp_grtba";
mclk = "extperiph1";
mode0 {
mclk_khz = "24000";
num_lanes = [32 00];
tegra_sinterface = "serial_c";
vc_id = [33 00];
phy_mode = "DPHY";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = [40 00];
dynamic_pixel_bit_depth = "12";
csi_pixel_bit_depth = "16";
mode_type = "yuv";
pixel_phase = "uyvy";
lane_polarity = [30 00];
active_w = "2560";
active_h = "1984";
readout_orientation = [30 00];
line_length = "3448";
inherent_gain = [31 00];
pix_clk_hz = "152371200";
serdes_pix_clk_hz = "800000000";
gain_factor = "10";
min_gain_val = [30 00];
max_gain_val = "480";
step_gain_val = [33 00];
default_gain = [30 00];
min_hdr_ratio = [31 00];
max_hdr_ratio = [31 00];
framerate_factor = "1000000";
min_framerate = "30000000";
max_framerate = "30000000";
step_framerate = [31 00];
default_framerate = "30000000";
exposure_factor = "1000000";
min_exp_time = "59";
max_exp_time = "33333";
step_exp_time = [31 00];
default_exp_time = "33333";
embedded_metadata_height = [30 00];
};
ports {
#address-cells = <0x01>;
#size-cells = <0x00>;
port@0 {
reg = <0x00>;
endpoint {
vc-id = <0x02>;
port-index = <0x02>;
bus-width = <0x02>;
remote-endpoint = <0x11>;
phandle = <0x2b6>;
};
};
};
};
};
tegra-capture-vi {
compatible = "nvidia,tegra-camrtc-capture-vi";
nvidia,vi-devices = <0x269 0x26b>;
nvidia,vi-mapping-size = <0x06>;
nvidia,vi-mapping = <0x00 0x00 0x01 0x00 0x02 0x01 0x03 0x01 0x04 0x00 0x05 0x01>;
nvidia,vi-mapping-names = "csi-stream-id\0vi-unit-id";
nvidia,vi-max-channels = <0x48>;
num-channels = <0x03>;
phandle = <0x49d>;
ports {
#address-cells = <0x01>;
#size-cells = <0x00>;
port@0 {
reg = <0x00>;
status = "okay";
phandle = <0x49e>;
endpoint {
vc-id = <0x00>;
port-index = <0x00>;
bus-width = <0x02>;
remote-endpoint = <0x26c>;
status = "okay";
phandle = <0x2b3>;
};
};
port@1 {
reg = <0x01>;
status = "okay";
phandle = <0x49f>;
endpoint {
vc-id = <0x00>;
port-index = <0x01>;
bus-width = <0x02>;
remote-endpoint = <0x26d>;
status = "okay";
phandle = <0x2b5>;
};
};
port@2 {
reg = <0x02>;
status = "okay";
phandle = <0x4a0>;
endpoint {
vc-id = <0x00>;
port-index = <0x02>;
bus-width = <0x02>;
remote-endpoint = <0x26e>;
status = "okay";
phandle = <0x2b7>;
};
};
nvcsi@15a00000 {
compatible = "nvidia,tegra194-nvcsi";
clocks = <0x02 0x51>;
clock-names = "nvcsi";
status = "okay";
num-channels = <0x03>;
#address-cells = <0x01>;
#size-cells = <0x00>;
num-tpg-channels = <0x24>;
phandle = <0x4c6>;
channel@0 {
reg = <0x00>;
status = "okay";
phandle = <0x4c7>;
ports {
#address-cells = <0x01>;
#size-cells = <0x00>;
port@0 {
reg = <0x00>;
status = "okay";
phandle = <0x4c8>;
endpoint@0 {
port-index = <0x00>;
bus-width = <0x02>;
remote-endpoint = <0x2b2>;
status = "okay";
phandle = <0x0a>;
};
};
port@1 {
reg = <0x01>;
status = "okay";
phandle = <0x4c9>;
endpoint@1 {
remote-endpoint = <0x2b3>;
status = "okay";
phandle = <0x26c>;
};
};
};
};
channel@1 {
reg = <0x01>;
status = "okay";
phandle = <0x4ca>;
ports {
#address-cells = <0x01>;
#size-cells = <0x00>;
port@0 {
reg = <0x00>;
status = "okay";
phandle = <0x4cb>;
endpoint@2 {
port-index = <0x01>;
bus-width = <0x02>;
remote-endpoint = <0x2b4>;
status = "okay";
phandle = <0x0b>;
};
};
port@1 {
reg = <0x01>;
status = "okay";
phandle = <0x4cc>;
endpoint@3 {
remote-endpoint = <0x2b5>;
status = "okay";
phandle = <0x26d>;
};
};
};
};
channel@2 {
reg = <0x02>;
status = "okay";
phandle = <0x4cd>;
ports {
#address-cells = <0x01>;
#size-cells = <0x00>;
port@0 {
reg = <0x00>;
status = "okay";
phandle = <0x4ce>;
endpoint@4 {
port-index = <0x02>;
bus-width = <0x02>;
remote-endpoint = <0x2b6>;
status = "okay";
phandle = <0x11>;
};
};
port@1 {
reg = <0x01>;
status = "okay";
phandle = <0x4cf>;
endpoint@5 {
remote-endpoint = <0x2b7>;
status = "okay";
phandle = <0x26e>;
};
};
};
};
tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
num_csi_lanes = <0x02>;
max_lane_speed = <0x16e360>;
min_bits_per_pixel = <0x0a>;
vi_peak_byte_per_pixel = <0x02>;
vi_bw_margin_pct = <0x19>;
isp_peak_byte_per_pixel = <0x05>;
isp_bw_margin_pct = <0x19>;
max_pixel_rate = <0x27100>;
tpg_max_iso = <0x3bc400>;
phandle = <0x53b>;
modules {
module0 {
badge = "max96724_bottom";
position = "bottom";
orientation = [31 00];
status = "okay";
phandle = <0x53c>;
drivernode0 {
pcl_id = "v4l2_sensor";
devname = "max96724 70-0001";
proc-device-tree = "/proc/device-tree/i2c@c250000/max96724@1";
status = "okay";
phandle = <0x53d>;
};
drivernode1 {
pcl_id = "v4l2_lens";
proc-device-tree = "/proc/device-tree/e3333_lens_ov5693@P5V27C/";
status = "disabled";
phandle = <0x53e>;
};
};
module1 {
badge = "max96724_top";
position = "top";
orientation = [31 00];
status = "okay";
phandle = <0x53f>;
drivernode0 {
pcl_id = "v4l2_sensor";
devname = "max96724 70-0002";
proc-device-tree = "/proc/device-tree/i2c@c250000/max96724@2";
status = "okay";
phandle = <0x540>;
};
drivernode1 {
pcl_id = "v4l2_lens";
proc-device-tree = "/proc/device-tree/e3333_lens_ov5693@P5V27C/";
status = "disabled";
phandle = <0x541>;
};
};
module2 {
badge = "max96724_left";
position = "left";
orientation = [31 00];
status = "okay";
phandle = <0x542>;
drivernode0 {
pcl_id = "v4l2_sensor";
devname = "max96724 70-0003";
proc-device-tree = "/proc/device-tree/i2c@c250000/max96724@3";
status = "okay";
phandle = <0x543>;
};
drivernode1 {
pcl_id = "v4l2_lens";
proc-device-tree = "/proc/device-tree/e3333_lens_ov5693@P5V27C/";
status = "disabled";
phandle = <0x544>;
};
};
Thanks
Reduce the serdes_pix_clk_hz to 187000000 to try.
When modified as instructed, an error similar to the file below occurs.
tracelog.txt (233.9 KB)
Boost the clocks to try.
sudo su
echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/emc/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/isp/rate
cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/emc/rate
I tried your answer, but i still occured error.
Here is my tarcelog.
tracelog.txt (16.9 MB)
Thanks.
There are short frame could be the output size less than expected.
And payload data CRC error.
kworker/1:2-161 [001] .... 175.354669: rtcpu_vinotify_event: tstamp:6638992584 cch:0 vi:1 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:0 vi_tstamp:212446948800 data:0x0000200001000000
kworker/1:2-161 [001] .... 175.354673: rtcpu_nvcsi_intr: tstamp:6639453056 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
Hmm, something is strange. I tried reducing active_h to 100, but the short frame error continues to appear.
I tried reducing active_w and active_h to 100x90, but short frames continue to appear, as shown in the attached file.
Is there any solution for this?
tracelog.txt (1.7 MB)
Thanks
Does the v4l2-ctl --list-fomats-ext show the correct size.
You may need to modify the driver not only the active_h
There is no information about resolution in my v4l2-ctl --list-formats-ext.
root@litbig:~# v4l2-ctl --list-formats-ext -d /dev/video2
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'BG10' (10-bit Bayer BGBG/GRGR)
However, if you type v4l2-ctl --all -d /dev/video2, the resolution and various contents will appear.
Driver Info:
Driver name : tegra-video
Card type : vi-output, max96724 7-0027
Bus info : platform:tegra-capture-vi:2
Driver version : 5.10.120
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : tegra-camrtc-ca
Model : NVIDIA Tegra Video Input Device
Serial :
Bus info :
Media version : 5.10.120
Hardware revision: 0x00000003 (3)
Driver version : 5.10.120
Interface Info:
ID : 0x0300001e
Type : V4L Video
Entity Info:
ID : 0x0000001c (28)
Name : vi-output, max96724 7-0027
Function : V4L2 I/O
Pad 0x0100001d : 0: Sink
Link 0x02000022: from remote pad 0x1000019 of entity '13e40000.host1x:nvcsi@15a00000-': Data, Enabled
Priority: 2
Video input : 0 (Camera 2: ok)
Format Video Capture:
Width/Height : 2560/1984
Pixel Format : 'BG10' (10-bit Bayer BGBG/GRGR)
Field : None
Bytes per Line : 5120
Size Image : 10158080
Colorspace : Default
Transfer Function : Default (maps to Rec. 709)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Camera Controls
frame_length 0x009a2000 (int) : min=1 max=32767 step=1 default=1134 value=1134 flags=slider
coarse_time 0x009a2001 (int) : min=1 max=32755 step=1 default=1122 value=1122 flags=slider
coarse_time_short 0x009a2002 (int) : min=1 max=32755 step=1 default=1122 value=1122 flags=slider
group_hold 0x009a2003 (intmenu): min=0 max=1 default=0 value=0
0: 0 (0x0)
1: 1 (0x1)
hdr_enable 0x009a2004 (intmenu): min=0 max=1 default=0 value=0
0: 0 (0x0)
1: 1 (0x1)
eeprom_data 0x009a2005 (str) : min=0 max=16384 step=2 value='' flags=volatile, has-payload
otp_data 0x009a2006 (str) : min=0 max=256 step=2 value='' flags=read-only, has-payload
gain 0x009a2009 (int) : min=1 max=31 step=1 default=2 value=2 flags=slider
sensor_configuration 0x009a2032 (u32) : min=0 max=4294967295 step=1 default=0 [22] flags=read-only, volatile, has-payload
sensor_mode_i2c_packet 0x009a2033 (u32) : min=0 max=4294967295 step=1 default=0 [1026] flags=read-only, volatile, has-payload
sensor_control_i2c_packet 0x009a2034 (u32) : min=0 max=4294967295 step=1 default=0 [1026] flags=read-only, volatile, has-payload
bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=0
0: 0 (0x0)
1: 1 (0x1)
override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0
0: 0 (0x0)
1: 1 (0x1)
height_align 0x009a2066 (int) : min=1 max=16 step=1 default=1 value=1
size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
0: 1 (0x1)
1: 65536 (0x10000)
2: 131072 (0x20000)
write_isp_format 0x009a2068 (int) : min=1 max=1 step=1 default=1 value=1
sensor_signal_properties 0x009a2069 (u32) : min=0 max=4294967295 step=1 default=0 [30][18] flags=read-only, has-payload
sensor_image_properties 0x009a206a (u32) : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
sensor_control_properties 0x009a206b (u32) : min=0 max=4294967295 step=1 default=0 [30][36] flags=read-only, has-payload
sensor_dv_timings 0x009a206c (u32) : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
low_latency_mode 0x009a206d (bool) : default=0 value=0
preferred_stride 0x009a206e (int) : min=0 max=65535 step=1 default=0 value=0
sensor_modes 0x009a2082 (int) : min=0 max=30 step=1 default=30 value=1 flags=read-only
Any advice on this?
Thanks
Looks like your driver have problem.
The command should show the size like below.
nvidia@tegra-ubuntu:~$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'RG10' (10-bit Bayer RGRG/GBGB)
Size: Discrete 3840x2160
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.017s (60.000 fps)
I listened to your words and successfully modified the driver code to make it as shown below. But the phenomenon is still the same.
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'BG10' (10-bit Bayer BGBG/GRGR)
Size: Discrete 1280x960
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1600x1300
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 2560x1984
Interval: Discrete 0.033s (30.000 fps)
Do you reduce the size and confirm by v4l2-ctl and still the trace show short frame?
Shortframe-related errors have disappeared.
However, an error occurs as shown below.
I will also attach the tracelog file.
kworker/6:2-2665 [006] .... 1296.406658: rtcpu_nvcsi_intr: tstamp:41656498725 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
kworker/6:2-2665 [006] .... 1296.406658: rtcpu_nvcsi_intr: tstamp:41656502257 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
tracelog.txt (23.6 MB)
The error tell the payload CRC error.
I found the related error details on the forum.
I understand that this error is a hardware problem, is that correct?
While analyzing the cause in the serializer, the register shown in the picture below is set to 1. Does this have anything to do with it?
I don’t know what problem is caused by changing this register to 1. I would appreciate it if you could let me know.
Sorry I don’t familiar with this serdes chip to give comment.