Hi Team,
I am trying to capture the preconfigured 8bit grayscale CSI data from an FPGA without I2C communication on Xavier NX board with L4T 32.5.
I have followed some similar implementations(Jetson Nano MIPI CSI-2 without I2C from FPGA) (Tx1 CSI without I2c - #33 by hburaksaruhan) and did the following changes.
- Added 8bit grayscale support using the following changes.
drivers/media/platform/tegra/camera/camera_common.c
static const struct camera_common_colorfmt camera_common_color_fmts[] = {
+ {
+ MEDIA_BUS_FMT_Y8_1X8, //GRAYSCALE 8 BITS
+ V4L2_COLORSPACE_RAW, //RAW
+ V4L2_PIX_FMT_GREY,
+ },
drivers/media/platform/tegra/camera/sensor_common.c
else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
*format = V4L2_PIX_FMT_VYUY;
+ else if (strncmp(pixel_t, "gray", size) == 0)
+ *format = V4L2_PIX_FMT_GREY;
drivers/media/platform/tegra/camera/vi/vi5_formats.h
static const struct tegra_video_format vi5_video_formats[] = {
+ TEGRA_VIDEO_FORMAT(RAW8, 8, Y8_1X8, 1, 1, T_R8, RAW8, GREY, "GRAY8"),
- Modified the ov5693 dtsi file to support FPGA csi configurations, single lane, csi port A, 1920x1080 @ 30fps and other configurations,
/ {
host1x {
status="okay";
vi@15c10000 {
status="okay";
num-channels = <1>;
ports {
status="okay";
#address-cells = <1>;
#size-cells = <0>;
vi_port0: port@0 {
status="okay";
reg = <0>;
rbpcv2_ov5693_vi_in0: endpoint {
status="okay";
port-index = <0>;
bus-width = <1>;
remote-endpoint = <&rbpcv2_ov5693_csi_out0>;
};
};
};
};
nvcsi@15a00000 {
status="okay";
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
csi_chan0: channel@0 {
status="okay";
reg = <0>;
ports {
status="okay";
#address-cells = <1>;
#size-cells = <0>;
csi_chan0_port0: port@0 {
status="okay";
reg = <0>;
rbpcv2_ov5693_csi_in0: endpoint@0 {
status="okay";
port-index = <0>;
bus-width = <1>;
remote-endpoint = <&rbpcv2_ov5693_out0>;
};
};
csi_chan0_port1: port@1 {
status="okay";
reg = <1>;
rbpcv2_ov5693_csi_out0: endpoint@1 {
status="okay";
remote-endpoint = <&rbpcv2_ov5693_vi_in0>;
};
};
};
};
};
};
i2c@3180000 {
rbpcv2_ov5693_a@36 {
compatible = "nvidia,ov5693";
reg = <0x36>;
devnode = "video0";
physical_w = "3.680";
physical_h = "2.760";
clocks = <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>,
<&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
clock-names = "extperiph1", "pllp_grtba";
mclk = "extperiph1";
clock-frequency = <24000000>;
status = "okay";
mode0 {
mclk_khz = "24000";
num_lanes = "1";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "1920";
active_h = "1080";
pixel_t="gray";
pixel_phase="y";
dynamic_pixel_bit_depth = "8";
csi_pixel_bit_depth = "8";
readout_orientation = "0";
line_length = "2200";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "42000000";
gain_factor = "10";
min_gain_val = "10"; /* 1.00x */
max_gain_val = "160"; /* 10.66x */
step_gain_val = "1";
default_gain = "10"; /* 1.00x */
min_hdr_ratio = "1";
max_hdr_ratio = "1";
framerate_factor = "1000000";
min_framerate = "1000000"; /* 2.0 fps */
max_framerate = "30000000"; /* 30.0 fps */
step_framerate = "1";
default_framerate = "30000000"; /* 30.0 fps */
exposure_factor = "1000000";
min_exp_time = "34"; /* us */
max_exp_time = "550385"; /* us */
step_exp_time = "1";
default_exp_time = "33334"; /* us */
embedded_metadata_height = "0";
};
ports {
status="okay";
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status="okay";
reg = <0>;
rbpcv2_ov5693_out0: endpoint {
status="okay";
port-index = <0>;
bus-width = <1>;
remote-endpoint = <&rbpcv2_ov5693_csi_in0>;
};
};
};
};
};
};
/ {
tcp: tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
num_csi_lanes = <1>;
max_lane_speed = <336000>;
min_bits_per_pixel = <8>;
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>;
status="okay";
modules {
status="okay";
cam_module0: module0 {
status="okay";
badge = "jakku_front_RBP194";
position = "front";
orientation = "1";
cam_module0_drivernode0: drivernode0 {
status="okay";
pcl_id = "v4l2_sensor";
devname = "ov5693 2-0036";
proc-device-tree = "/proc/device-tree/i2c@3180000/rbpcv2_ov5693_a@36";
};
};
};
};
};
- Disabled the camera plugins and added status=“okay”; in camera nodes.
- Modified the driver files ov5693.c and ov5693_mode_tbls.h to ignore the I2C and reset/pwdn gpio part.
ov5693_mode_tbls.h (1.3 KB)
ov5693.c (14.4 KB) - Compiled the kernel, Flashed the board, and tested the data capture.
The CSI video node registration is happening and I got the /dev/video0 node,
$ ls /dev/video0
/dev/video0
$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'GREY'
Name : 8-bit Greyscale
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100 --stream-to=test.raw
I got the following error
[ +2.568005] tegra194-vi5 15c10000.vi: no reply from camera processor
[ +0.000167] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms
[ +0.000177] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel
[ +0.002355] tegra194-vi5 15c10000.vi: err_rec: successfully reset the capture channel
[ +2.557313] tegra194-vi5 15c10000.vi: no reply from camera processor
[ +0.000222] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms
[ +0.000178] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel
[ +0.000190] tegra194-vi5 15c10000.vi: unexpected response from camera processor
[ +0.000136] video4linux video0: vi capture release failed
[ +0.000102] tegra194-vi5 15c10000.vi: fatal: error recovery failed
Could you provide some inputs to debug further on this issue ?
Thanks,
Ajith.