How to set the mode properties for a camera?

I am doing camera development over a MIPI + GMSL interface & am having issues connecting with gstreamer.

I believe I have the same issue as described in this thread, as the logs & stack-trace match: Argus API is not stable in JetPack 5 and gstreamer doesnt work - #10 by chakibdace

However, I have not been able to figure out how to see the mode properties or how to alter them.

Inline example from the linked thread; I am not sure where to find the values below or how to change them.

				mode0 {/*mode AR0820_MODE_3848X2168_30FPS*/
					mclk_khz = "24000";
					num_lanes = "4";
					tegra_sinterface = "serial_a";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";

					dynamic_pixel_bit_depth = "12";
					csi_pixel_bit_depth = "12";
					mode_type = "bayer";
					pixel_phase = "grbg";

					active_w = "3848";
					active_h = "2168";
					readout_orientation = "0";
					line_length = "4440";
					inherent_gain = "1";
					mclk_multiplier = "14.58";
					pix_clk_hz = "296236800";
					serdes_pix_clk_hz = "833333333";

					gain_factor = "1";
					min_gain_val = "1";
					max_gain_val = "15";
					step_gain_val = "1";
					default_gain = "1";
					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 = "33333";
					step_exp_time = "1";
					default_exp_time = "33333";

					embedded_metadata_height = "0";
				};

Is there a standard mechanism for finding / seeing these values?

Using the IMX538 & Jetpack 5.X.

Thanks

@will.marsman did u tried to change the serdes_pix_clk value ?
It seems that JP 5.x add the deskew calibration so try to update this value (reduce it), in my case, the problem was solved by updating this parameter.

The values above are from the device tree related to ar0820 sensor for galen target (Jetson AGX Xavier)

You have to check your device tree related to your sensor, it’s a .dtsi (device tree source include) file.

If you are using the jetson nano, the code of this tagret is prog You will find it in a path …/t210/prog/…

1 Like

Coming back to share the solution.

I didn’t have any experience with working with camera sensors before now so I figured it would be good to share with others who might have similar issues & is similarly confused.

Updating dts/dto files

I was developing on a Jetson Orin Nano devkit with Jetpack 5.1. The IMX538 camera sensor was outputting approx 60fps at a little over 1,920 x 1,080 resolution.

To answer to the original question of how to modify device trees; I needed to install dtc, find the related *.dto (or *.dtbo in my case) files.

To find the *.dtbo files, I ran a find command to search for files with this extension from

find . -iname "*.dtbo" -print 2>/dev/null

Then I used dtc to get the dts file from the dto file and see what values were set.

dtc -I dtb -O dts <filepath>.dtbo

From there I could use dtc to update the values in the dtbo file, with the dts as reference. I had 4 connectors, J5 through J8, so I updated each gmsl + mipi dtbo with the values I calculated after referencing the thread linked in the original post.

The Ubuntu man page for dtc has more information on working with device trees.

Next, for the issue itself.

Resolving nvarguscamerasrc dmabuf_fd -1 mapped entry NOT found

I was seeing the same issue as @chakibdace, with the exact same exceptions, stack-traces, etc.

For me, I only saw the issue with nvarguscamerasrc when I set the camera sensor up with mipi over gmsl.

  • If I used v4l with mipi over gmsl, it worked fine.
  • If I used nvarguscamerasrc with mipi only, it worked fine.
  • I also had a pre-compiled program called argus_camera which worked over mipi over gmsl, so it didn’t seem like it was an issue with libargus specifically.

The only difference is restarting nvargus-daemon did not fix the problem for me temporarily.

I tried to compute and then adjust the deskew calibration, adjusting both pix_clk_hz & serdes_pix_clk_hz. Maybe I didn’t calculate it properly or reduce it enough but it did not solve the problem for me.

I tried compiling the jetpack-multimedia-samples found on the device. It took me a long time to find these as I didn’t realize the sources were on the OS. I tried pulling them from a few different github repos and such, and could never compile them that way.

I tried running nvarguscamerasrc with an infinite timeout, same issue.

I had to use the jetpack samples on the device already. As of Jetpack 5.1, they are found in/usr/src/jetson_multimedia_api.

Note, the links below are to an unrelated repo which have older versions of these sources. Merely linking here as I do not know how to link to the official sources directly like this.

For me, I needed to look at 09_camera_jpeg_capture, 10_camera_recording and 13_multi_camera.

I compiled 09 and 10 and neither worked, with the error somewhat swallowed by the program. Then I compiled and tried 13, and it worked! Reading over the source for 13, I noticed there was no timeout. I increased the timeouts in the 09 sample by a factor of 10 and it started working as well.

Then I downloaded the source for nvarguscamerasrc from https://developer.nvidia.com/embedded/jetson-linux-r3531, downloading the “Driver Package (BSP) Sources”. Once I had extracted the folder, I put the nvarguscamerasrc folder beside the other samples found in /usr/src/jetson_multimedia_api, updated the Makefile for /usr/src/jetson_multimedia_api to include nvarguscamerasrc as a target, and ran make install.

This installs nvarguscamerasrc overtop the shipped one. So I was good to try and patch this at this point.

I edited the two timeouts in the source for this to be10x what were set in the source by default and it started working without issue.

static const uint64_t WAIT_FOR_EVENT_TIMEOUT  = 30000000000; // previously 3000000000
static const uint64_t ACQUIRE_FRAME_TIMEOUT   = 50000000000; // previously 5000000000

I still have to test to see how much I need to increase the timeouts in nvarguscamerasrc in order to avoid the problem. I might only need to adjust one of them as well.

Anyways this is what worked for me. I don’t know if there was an easier way or if I missed something, but this is how I got mipi + gmsl working with nvarguscamerasrc for our camera sensor.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.