HI,
I am trying to set up AR0821 camera to stream in Xavier NX. Camera is connected to CSI2 port. Below are my changes in device tree:
#include <dt-bindings/media/camera.h>
/ {
host1x {
vi@15c10000 {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
liar0821_vi_in2: endpoint {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&liar0821_csi_out2>;
};
};
};
};
nvcsi@15a00000 {
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
liar0821_csi_in2: endpoint@0 {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&liar0821_ar0821_out2>;
};
};
port@1 {
reg = <1>;
liar0821_csi_out2: endpoint@1 {
remote-endpoint = <&liar0821_vi_in2>;
};
};
};
};
};
};
i2c@3180000 {
ar0821_c@1d {
compatible = "nvidia,ar0821";
/* I2C device address */
reg = <0x1d>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "3.674";
physical_h = "2.738";
sensor_model = "ar0821";
/* Define any required hw resources needed by driver */
/* ie. clocks, io pins, power sources */
/* Defines number of frames to be dropped by driver internally after applying */
/* sensor crop settings. Some sensors send corrupt frames after applying */
/* crop co-ordinates */
post_crop_frame_drop = "0";
/* if true, delay gain setting by one frame to be in sync with exposure */
//delayed_gain = "true";
//use_decibel_gain = "true";
/* has-eeprom; */
/* fuse_id_start_addr = <91>; */
//use_sensor_mode_id = "true";
/**
* ==== Modes ====
* A modeX node is required to support v4l2 driver
* implementation with NVIDIA camera software stack
*
* == Signal properties ==
*
* phy_mode = "";
* PHY mode used by the MIPI lanes for this device
*
* tegra_sinterface = "";
* CSI Serial interface connected to tegra
* Incase of virtual HW devices, use virtual
* For SW emulated devices, use host
*
* pix_clk_hz = "";
* Sensor pixel clock used for calculations like exposure and framerate
*
* readout_orientation = "0";
* Based on camera module orientation.
* Only change readout_orientation if you specifically
* Program a different readout order for this mode
*
* == Image format Properties ==
*
* active_w = "";
* Pixel active region width
*
* active_h = "";
* Pixel active region height
*
* pixel_t = "";
* The sensor readout pixel pattern
*
* line_length = "";
* Pixel line length (width) for sensor mode.
*
* == Source Control Settings ==
*
* Gain factor used to convert fixed point integer to float
* Gain range [min_gain/gain_factor, max_gain/gain_factor]
* Gain step [step_gain/gain_factor is the smallest step that can be configured]
* Default gain [Default gain to be initialized for the control.
* use min_gain_val as default for optimal results]
* Framerate factor used to convert fixed point integer to float
* Framerate range [min_framerate/framerate_factor, max_framerate/framerate_factor]
* Framerate step [step_framerate/framerate_factor is the smallest step that can be configured]
* Default Framerate [Default framerate to be initialized for the control.
* use max_framerate to get required performance]
* Exposure factor used to convert fixed point integer to float
* For convenience use 1 sec = 1000000us as conversion factor
* Exposure range [min_exp_time/exposure_factor, max_exp_time/exposure_factor]
* Exposure step [step_exp_time/exposure_factor is the smallest step that can be configured]
* Default Exposure Time [Default exposure to be initialized for the control.
* Set default exposure based on the default_framerate for optimal exposure settings]
* For convenience use 1 sec = 1000000us as conversion factor
*
* gain_factor = ""; (integer factor used for floating to fixed point conversion)
* min_gain_val = ""; (ceil to integer)
* max_gain_val = ""; (ceil to integer)
* step_gain_val = ""; (ceil to integer)
* default_gain = ""; (ceil to integer)
* Gain limits for mode
*
* exposure_factor = ""; (integer factor used for floating to fixed point conversion)
* min_exp_time = ""; (ceil to integer)
* max_exp_time = ""; (ceil to integer)
* step_exp_time = ""; (ceil to integer)
* default_exp_time = ""; (ceil to integer)
* Exposure Time limits for mode (sec)
*
* framerate_factor = ""; (integer factor used for floating to fixed point conversion)
* min_framerate = ""; (ceil to integer)
* max_framerate = ""; (ceil to integer)
* step_framerate = ""; (ceil to integer)
* default_framerate = ""; (ceil to integer)
* Framerate limits for mode (fps)
*
* embedded_metadata_height = "";
* Sensor embedded metadata height in units of rows.
* If sensor does not support embedded metadata value should be 0.
* num_of_exposure = "";
* Digital overlap(Dol) frames
*
* num_of_ignored_lines = "";
* Used for cropping, eg. OB lines + Ignored area of effective pixel lines
*
* num_of_lines_offset_0 = "";
* Used for cropping, vertical blanking in front of short exposure data
* If more Dol frames are used, it can be extended, eg. num_of_lines_offset_1
*
* num_of_ignored_pixels = "";
* Used for cropping, The length of line info(pixels)
*
* num_of_left_margin_pixels = "";
* Used for cropping, the size of the left edge margin before
* the active pixel area (after ignored pixels)
*
* num_of_right_margin_pixels = "";
* Used for cropping, the size of the right edge margin after
* the active pixel area
*
*/
mode0 {/*mode AR0821_MODE_3840X2160_CROP_30FPS*/
mclk_khz = "24000";
num_lanes = "4";
tegra_sinterface = "serial_c";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = "0";
dynamic_pixel_bit_depth = "12";
csi_pixel_bit_depth = "12";
mode_type = "bayer";
pixel_phase = "bggr";
active_w = "3840";
active_h = "2160";
readout_orientation = "0";
line_length = "4440";
inherent_gain = "1";
mclk_multiplier = "14.58";
pix_clk_hz = "296236800";
gain_factor = "65536";
min_gain_val = "65536";
max_gain_val = "1048576";
step_gain_val = "1";
default_gain = "65536";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
framerate_factor = "1000000";
min_framerate = "30000000";
max_framerate = "30000000";
step_framerate = "1";
default_framerate = "30000000";
exposure_factor = "1000000";
min_exp_time = "15";
max_exp_time = "11000";
step_exp_time = "1";
default_exp_time = "11000";
embedded_metadata_height = "2";
};
mode1 {/*mode AR0821_MODE_1920X1080_30FPS*/
mclk_khz = "24000";
num_lanes = "4";
tegra_sinterface = "serial_c";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = "0";
dynamic_pixel_bit_depth = "12";
csi_pixel_bit_depth = "12";
mode_type = "bayer";
pixel_phase = "bggr";
active_w = "1920";
active_h = "1080";
readout_orientation = "0";
line_length = "2472";
inherent_gain = "1";
mclk_multiplier = "14.58";
pix_clk_hz = "296236800";
gain_factor = "65536";
min_gain_val = "65536";
max_gain_val = "1048576";
step_gain_val = "1";
default_gain = "65536";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
framerate_factor = "1000000";
min_framerate = "30000000";
max_framerate = "30000000";
step_framerate = "1";
default_framerate = "30000000";
exposure_factor = "1000000";
min_exp_time = "8";
max_exp_time = "11000";
step_exp_time = "1";
default_exp_time = "11000";
embedded_metadata_height = "2";
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
liar0821_ar0821_out2: endpoint {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&liar0821_csi_in2>;
};
};
};
};
};
};
/ {
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 = <12>;
max_lane_speed = <1500000>;
min_bits_per_pixel = <12>;
vi_peak_byte_per_pixel = <2>;
vi_bw_margin_pct = <25>;
max_pixel_rate = <750000>;
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 {
module0 {
badge = "ar0821_bottomleft_liar0821";
position = "bottomleft";
orientation = "1";
drivernode0 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "ar0821 2-001d";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@3180000/ar0821_c@1d";
};
};
};
};
};
#define CAM0_RST_L TEGRA194_MAIN_GPIO(Q, 6)
#define CAM0_PWDN TEGRA194_AON_GPIO(CC, 4)
#define CAM1_RST_L TEGRA194_MAIN_GPIO(Q, 6)
#define CAM1_PWDN TEGRA194_AON_GPIO(CC, 4)
#define CAMERA_I2C_MUX_BUS(x) (0x1E + x)
/* camera control gpio definitions */
/ {
gpio@2200000 {
camera-control-output-low {
gpio-hog;
output-low;
gpios = <CAM0_RST_L 0 CAM0_PWDN 0>;
label = “cam0-rst”, “cam0-pwdn”;
};
};
i2c@3180000 {
ar0821_c@1d {
status = "okay";
clocks = <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>,
<&bpmp_clks TEGRA194_CLK_EXTPERIPH1>;
clock-names = "extperiph1", "pllp_grtba";
mclk = "extperiph1";
reset-gpios = <&tegra_main_gpio CAM1_RST_L GPIO_ACTIVE_HIGH>;
vana-supply = <&p3509_avdd_cam_2v8>;
vif-supply = <&p3509_vdd_1v8_cvb>;
vdig-supply = <&p3509_vdd_sys_en>;
};
};
};
After above changes, I can see the camera binding in dmesg log as below
[ 14.258406] ar0821 2-001d: probing v4l2 sensor.
[ 14.262553] ar0821 2-001d: tegracam sensor driver:ar0821_v2.0.6
[ 14.262615] tegra194-vi5 15c10000.vi: subdev ar0821 2-001d bound
[ 14.267745] ar0821 2-001d: Detected AR0821 sensor
However, when I try to stream it by gstreamer command. The error is as below
===== NVMEDIA: NVENC =====
/GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0.GstPad:src: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
NvMMLiteBlockCreate : Block : BlockType = 8
/GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay0.GstPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
Redistribute latency…
Setting pipeline to PLAYING …
/GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
New clock: GstSystemClock
Error generated. /home/danel/r32_2/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:530 No cameras available
Got EOS from element “pipeline0”.
Execution ended after 0:00:00.037054304
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …
(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 266)
(Argus) Error EndOfFile: Receive worker failure, notifying 1 waiting threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 340)
(Argus) Error InvalidState: Argus client is exiting with 1 outstanding client threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 357)
(Argus) Error EndOfFile: Client thread received an error from socket (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 145)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 368)
(Argus) Error EndOfFile: (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 91)
Can you let me know what’s wrong in my device tree change? Thank you