Autoexposure not working for nvarguscamerasource

Hi,

we have implemented a new Sensor as shown in the l4t wiki. everything works fine except the autogain/autoexposure features.

The settings are very close to the example settings from tegra210-camera-rbpcv2-imx219.dtsi

when we start the gstreamer pipeline:
gst-launch-1.0 nvarguscamerasrc exposuretimerange="100000000 200000000" ! 'video/x-raw(memory:NVMM), width=1920, height=1080, framerate=30/1' ! nvoverlaysink -e

the settings that are printed are following:
GST_ARGUS: 1920 x 1080 FR = 1000.000000 fps Duration = 1000000 ; Analog Gain range min 0.000000, max 14.285714; Exposure Range min 100000, max 1000000000;

But in the stream just the gain is regulated and exosure remains the same all the time. Is this the right behaviour? How we can turn or change the settings that Autoexposure works?

our settings for the nvarguscamerasrc in the device tree are:

mode0 {/*mode OS02C10_MODE_1920X1080_CROP_30FPS*/
                mclk_khz = "24000";
                num_lanes = "4";
                tegra_sinterface = "serial_a";
                phy_mode = "DPHY";
                discontinuous_clk = "no";
                dpcm_enable = "false";
                cil_settletime = "0";
                dynamic_pixel_bit_depth = "10";
                csi_pixel_bit_depth = "10";
                mode_type = "bayer";
                pixel_phase = "bggr";

                active_w = "1920";
                active_h = "1080";
                readout_orientation = "0";
                line_length = "2560";
                inherent_gain = "1";
                pix_clk_hz = "288000000";
                //serdes_pix_clk_hz = "320000000";

                gain_factor = "7";
                min_gain_val = "0";
                max_gain_val = "100";
                step_gain_val = "1";
                default_gain = "0";
                min_hdr_ratio = "1";
                max_hdr_ratio = "1";
                framerate_factor = "1";
                min_framerate = "1";
                max_framerate = "1000";
                step_framerate = "1";
                default_framerate= "30";
                exposure_factor = "1000000";
                min_exp_time = "100";
                max_exp_time = "1000000";
                step_exp_time = "1";
                default_exp_time = "9000";
                embedded_metadata_height = "0";};

How do you confirm it not working. The log show the sensor cap instead of the limite range for the alg setting. You can try to set the range to smaller renge to check if the setting is apply like set the “100000 100000” and “1000000000 1000000000” to compare.

Sorry i didnt mention. We added prints in the driver whenever gain or exposure is changes/registers in the sensor are printed. there are just gain prints and never exposure prints. when we set gain to a fix value (for example “5 5”) there are no prints at all.

I check with the imx219 there’s no problem to set the exposure like below.

gst-launch-1.0 nvarguscamerasrc exposuretimerange="1000000 1000000" ! nvoverlaysink -e

[552181.126460] imx219 6-0010: imx219_power_on: power on
[552181.149672] imx219 6-0010: imx219_power_off: power off
[552181.149826] imx219 6-0010: imx219_power_on: power on
[552181.173099] imx219 6-0010: imx219_power_off: power off
[552181.392707] imx219 6-0010: imx219_power_on: power on
[552181.415996] imx219 6-0010: imx219_set_gain: val: 16 (/16) [times], gain: 0
[552181.416570] imx219 6-0010: imx219_set_gain: val: 170 (/16) [times], gain: 232
[552181.416797] imx219 6-0010: imx219_set_exposure: val: 1000 [us], coarse_time: 52 [lines]
[552181.439687] imx219 6-0010: imx219_set_gain: val: 170 (/16) [times], gain: 232
[552181.439881] imx219 6-0010: imx219_set_exposure: val: 1000 [us], coarse_time: 52 [lines]
[552181.440253] imx219 6-0010: imx219_set_frame_rate: val: 30000000e-6 [fps], frame_length: 1763 [lines]
[552181.810639] imx219 6-0010: imx219_set_gain: val: 169 (/16) [times], gain: 232

Hello,
I work for the same company.

We have everything implemented as the imx219, but something must be different, otherwise, it would probably be working.
Do you have any help for us to find out what could be wrong with our driver implementation or our device tree? How could we go more into debugging for nvarguscamerasrc.

Our linked function to set_exposure should be printing stuff, but we dont see the prints. So it seems the function does not get called for some reason. What could be the reason that nvarguscamerasrc does not even try to set exposure with our driver?

Best regards,
jb

Can you also post what is the output of the GStreamer command in the command line, not only the debug messages of the kernel module?

I think it would be helpful for us to compare! :)

The command is in the second line of the comment that include the log.
Have a check for the sensor programing guide to check the driver implement.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fcamera_sensor_prog.html%23

Additional note:
Not sure about how you are measuring it, but be aware that some other auto adjustment may also affect final image.
You may limit gainrange, ispdigitalgainrange, disable AWB for seeing it with more evidence.

I’d suggest to have one terminal monitoring gain and exposure from v4L API (assuming video0 as device):

watch -n1 'v4l2-ctl -d0 --get-ctrl=exposure,gain'

and then launch this gstreamer pipeline in another terminal:

gst-launch-1.0 nvarguscamerasrc exposuretimerange="1000000 20000000" ! nvoverlaysink -e

# or
gst-launch-1.0 nvarguscamerasrc exposuretimerange="1000000 20000000" ispdigitalgainrange="8 8" ! nvoverlaysink -e

Moving your camera to dark or lightened zones, you may see differences.
(tested on Xavier NX R32.4.3 with a IMX219 PiV2 cam and not using any camera_overrides.isp)

When writing the sensor driver, we have connected our set_exposure function with the set_exposure from the tegra_device. So I guess this is the function that would be called, right? Inside our function, we have a print, which says the function is used and with what value. This works totally fine with v4l2-ctl.
Your way of watching the values seems nice for debugging. We can see gain changing that way but no exposure. Fixing gain to a range or value works well.

Maybe it is related that the overall function is not working very well either.
So the framerate is getting set to different values in the beginning. The last one seems to be the minimum value in the device tree. The exposure is not set over time, but I have seen it being set right in the beginning to one value, which also seems to be the minimum value being set in the device tree.

Also, the gain has some flickering when the overall image becomes dark. It starts to go up and down really fast so the image is changing from a little bit too dark to a little bit too light.

Also, I am noticing that if I set for example gain in v4l2-ctl 2 times the same value, my gain function is only called once. So it seems there is some pre-filtering before my driver functions get called. Is this intended behaviour? So maybe the set_exposure from nvarguscamerasrc is lost there?

Any help would be really appreciated, thank you very much. While trying around with different device tree setting I changed some stuff. So I will repost my device tree and the prints I am getting. I was trying to do everything like imx219. We also bought an imx219 for comparision in behaviour, but it will take some days until its here.

Best regards,
jb

The command is in the second line of the comment that include the log.

Sorry, I think you missunderstood. I see the command. But when you type in the command in the command line, GStreamer and nvarguscamerasrc should also make prints, which would be good to see for us.

What you showed are the prints from the imx219 driver.

Thank you for your help!

So I have made more tests, so I can give you more prints.
In general he sets exposure and framerate to the lowest possible values and after that does not change anything if I fix gain. If I dont fix gain, he is changing gain to compensate the light circumstances. But he does not use exposure.

Also I was seeing something interesting with my gain. It seems like it is using another gain_factor than I am specifying. Instead of my 7 he is using 4. I can see this when setting gain_range and also he does not go over the value 57, which is 14,285714 * 4.
→ 14,285714 is 100/7, so my max_gain/gain_factor.

I was looking everywhere where he can get this gain_factor = 4 from. Its not in any examples. I remember there was a time when I was using gain_factor = 4 (you can also see it in the other modes, there it is also from the past). Is it possible he is not updating this value when I flash the new device tree? In general my device tree flash works, because the prints from gstreamer command and v4l2-ctl is adapting.
If something is wrong with updating, it could of course also be not correctly updating exposure and framerate settings and maybe this is why it is not working? Do I need a complete re-flash?

EDIT: I did a re-flash and the behaviour is the same!

command:

gst-launch-1.0 nvarguscamerasrc gainrange=“4 4” ! nvoverlaysink -e

print:

GST_ARGUS: NvArgusCameraSrc: Setting Gain Range : 4 4
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected…
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1920 x 1080 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 0,000000, max 14,285714; Exposure Range min 100000, max 1000000000;

GST_ARGUS: 960 x 540 FR = 1000,000000 fps Duration = 1000000 ; Analog Gain range min 0,000000, max 15,750000; Exposure Range min 1000, max 10000000;

GST_ARGUS: 960 x 540 FR = 1000,000000 fps Duration = 1000000 ; Analog Gain range min 0,000000, max 14,285714; Exposure Range min 1000000, max 1000000000;

GST_ARGUS: 1920 x 270 FR = 1000,000000 fps Duration = 1000000 ; Analog Gain range min 0,000000, max 15,750000; Exposure Range min 1000, max 10000000;

GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 0
Output Stream W = 1920 H = 1080
seconds to Run = 0
Frame Rate = 29,999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.

driver print:

[Okt15 12:50] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000012] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,258794] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,000585] OS02C10 6-0036: OS02C10_set_exposure called with value 100 us
[ +0,002584] OS02C10 6-0036: OS02C10_set_frame_rate called with value 1000000 which translates to 1.0 fps
[ +0,222641] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000047] OS02C10 6-0036: OS02C10_set_gain called with value 16 which translates to approximately 2.2 gain_multiplication
[ +0,001790] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,035793] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000148] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,003302] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,003766] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000038] OS02C10 6-0036: OS02C10_set_gain called with value 16 which translates to approximately 2.2 gain_multiplication
[ +0,000852] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE

Using no gain range:

gst-launch-1.0 nvarguscamerasrc ! nvoverlaysink -e

print:

GST_ARGUS: NvArgusCameraSrc: Setting Gain Range : 4 4
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected…
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1920 x 1080 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 0,000000, max 14,285714; Exposure Range min 100000, max 1000000000;

GST_ARGUS: 960 x 540 FR = 1000,000000 fps Duration = 1000000 ; Analog Gain range min 0,000000, max 15,750000; Exposure Range min 1000, max 10000000;

GST_ARGUS: 960 x 540 FR = 1000,000000 fps Duration = 1000000 ; Analog Gain range min 0,000000, max 14,285714; Exposure Range min 1000000, max 1000000000;

GST_ARGUS: 1920 x 270 FR = 1000,000000 fps Duration = 1000000 ; Analog Gain range min 0,000000, max 15,750000; Exposure Range min 1000, max 10000000;

GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 0
Output Stream W = 1920 H = 1080
seconds to Run = 0
Frame Rate = 29,999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
^Chandling interrupt.
Interrupt: Stopping pipeline …
EOS on shutdown enabled – Forcing EOS on the pipeline
Waiting for EOS…
Got EOS from element “pipeline0”.
EOS received - stopping pipeline…
Execution ended after 0:00:57.799422868
Setting pipeline to PAUSED …
Setting pipeline to READY …
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL …
Freeing pipeline …

driver prints:

[Okt15 12:51] OS02C10 6-0036: OS02C10_set_gain called with value 16 which translates to approximately 2.2 gain_multiplication
[ +0,000583] OS02C10 6-0036: OS02C10_set_exposure called with value 100 us
[ +0,002990] OS02C10 6-0036: OS02C10_set_frame_rate called with value 1000000 which translates to 1.0 fps
[ +0,425479] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,000873] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,241888] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,000391] OS02C10 6-0036: OS02C10_set_exposure called with value 100 us
[ +0,001473] OS02C10 6-0036: OS02C10_set_frame_rate called with value 1000000 which translates to 1.0 fps
[ +0,213978] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 13 which translates to approximately 1.6 gain_multiplication
[ +0,000439] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,033446] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000011] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,000521] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000347] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000011] OS02C10 6-0036: OS02C10_set_gain called with value 13 which translates to approximately 1.6 gain_multiplication
[ +0,000419] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,892126] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 15 which translates to approximately 2.1 gain_multiplication
[ +0,000675] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125399] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000011] OS02C10 6-0036: OS02C10_set_gain called with value 17 which translates to approximately 2.3 gain_multiplication
[ +0,000571] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125699] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 19 which translates to approximately 2.5 gain_multiplication
[ +0,000576] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125543] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 22 which translates to approximately 3.1 gain_multiplication
[ +0,000565] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125622] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 24 which translates to approximately 3.3 gain_multiplication
[ +0,000607] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125558] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 27 which translates to approximately 3.6 gain_multiplication
[ +0,000589] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125586] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000015] OS02C10 6-0036: OS02C10_set_gain called with value 30 which translates to approximately 4.2 gain_multiplication
[ +0,000630] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125529] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000014] OS02C10 6-0036: OS02C10_set_gain called with value 34 which translates to approximately 4.6 gain_multiplication
[ +0,000618] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125516] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000014] OS02C10 6-0036: OS02C10_set_gain called with value 38 which translates to approximately 5.3 gain_multiplication
[ +0,000475] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125730] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 43 which translates to approximately 6.1 gain_multiplication
[ +0,000595] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125517] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 41 which translates to approximately 5.6 gain_multiplication
[ +0,000473] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125742] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 40 which translates to approximately 5.5 gain_multiplication
[ +0,000486] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125600] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 39 which translates to approximately 5.4 gain_multiplication
[ +0,000936] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125341] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 45 which translates to approximately 6.3 gain_multiplication
[ +0,000625] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,251756] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 52 which translates to approximately 7.3 gain_multiplication
[ +0,000627] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,125514] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000015] OS02C10 6-0036: OS02C10_set_gain called with value 57 which translates to approximately 8.1 gain_multiplication
[ +0,000539] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE

Modes in Device Tree:

mode0 {/mode OS02C10_MODE_1920X1080_CROP_30FPS/
mclk_khz = “24000”;
num_lanes = “4”;
tegra_sinterface = “serial_a”;
phy_mode = “DPHY”;
discontinuous_clk = “no”;
dpcm_enable = “false”;
cil_settletime = “0”;
dynamic_pixel_bit_depth = “10”;
csi_pixel_bit_depth = “10”;
mode_type = “bayer”;
pixel_phase = “bggr”;

                active_w = "1920";
                active_h = "1080";
                readout_orientation = "0";
                line_length = "2560";
                inherent_gain = "1";
                //pix_clk_hz = "288000000";
                pix_clk_hz = "384000000";
                //serdes_pix_clk_hz = "320000000";

                gain_factor = "7";
                min_gain_val = "0";
                max_gain_val = "100";
                step_gain_val = "1";
                default_gain = "0";
                min_hdr_ratio = "1";
                max_hdr_ratio = "1";
                framerate_factor = "1000000";
                min_framerate = "1000000";
                max_framerate = "30000000";
                step_framerate = "1";
                default_framerate= "30000000";
                exposure_factor = "1000000";
                min_exp_time = "100";
                max_exp_time = "1000000";
                step_exp_time = "1";
                default_exp_time = "9000";
                embedded_metadata_height = "0";};

				mode1 {/*mode OS02C10_MODE_1920X1080_CROP_30FPS*/
                    mclk_khz = "24000";
                    num_lanes = "4";
                    tegra_sinterface = "serial_a";
                    phy_mode = "DPHY";
                    discontinuous_clk = "no";
                    dpcm_enable = "false";
                    cil_settletime = "0";
                    dynamic_pixel_bit_depth = "10";
                    csi_pixel_bit_depth = "10";
                    mode_type = "bayer";
                    pixel_phase = "bggr";

                    active_w = "960";
                    active_h = "540";
                    readout_orientation = "0";
                    line_length = "1100";
                    inherent_gain = "1";
                     pix_clk_hz = "384000000";

                    gain_factor = "4";
                    min_gain_val = "0"; /* 0dB */
                    max_gain_val = "63"; /* 48dB */
                    step_gain_val = "1"; /* 0.3 */
                    default_gain = "0";
                    min_hdr_ratio = "1";
                    max_hdr_ratio = "1";
                    framerate_factor = "1";
                    min_framerate = "1"; /* 1.5 */
                    max_framerate = "1000"; /* 30 */
                    step_framerate = "1";
                    default_framerate= "60";
                    exposure_factor = "10";
                    min_exp_time = "1"; /* us */
                    max_exp_time = "10000"; /* us */
                    step_exp_time = "1";
                    default_exp_time = "90";/* us */
                    embedded_metadata_height = "0";
				};
                mode2 {/*mode OS02C10_MODE_1920X1080_CROP_30FPS*/
                    mclk_khz = "24000";
                    num_lanes = "4";
                    tegra_sinterface = "serial_a";
                    phy_mode = "DPHY";
                    discontinuous_clk = "no";
                    dpcm_enable = "false";
                    cil_settletime = "0";
                    dynamic_pixel_bit_depth = "10";
                    csi_pixel_bit_depth = "10";
                    mode_type = "bayer";
                    pixel_phase = "bggr";

                    active_w = "960";
                    active_h = "540";
                    readout_orientation = "0";
                    line_length = "1100";
                    inherent_gain = "1";
                     pix_clk_hz = "384000000";

                    gain_factor = "7";
                    min_gain_val = "0"; /* 0dB */
                    max_gain_val = "100"; /* 48dB */
                    step_gain_val = "1"; /* 0.3 */
                    default_gain = "0";
                    min_hdr_ratio = "1";
                    max_hdr_ratio = "1";
                    framerate_factor = "1";
                    min_framerate = "1"; /* 1.5 */
                    max_framerate = "1000"; /* 30 */
                    step_framerate = "1";
                    default_framerate= "60";
                    exposure_factor = "1";
                    min_exp_time = "1000"; /* us */
                    max_exp_time = "1000000"; /* us */
                    step_exp_time = "100";
                    default_exp_time = "9000";/* us */
                    embedded_metadata_height = "0";
                };
                mode3 {/*mode OS02C10_MODE_1920X1080_CROP_30FPS*/
                    mclk_khz = "24000";
                    num_lanes = "4";
                    tegra_sinterface = "serial_a";
                    phy_mode = "DPHY";
                    discontinuous_clk = "no";
                    dpcm_enable = "false";
                    cil_settletime = "0";
                    dynamic_pixel_bit_depth = "10";
                    csi_pixel_bit_depth = "10";
                    mode_type = "bayer";
                    pixel_phase = "bggr";

                    active_w = "1920";
                    active_h = "270";
                    readout_orientation = "0";
                    line_length = "1100";
                    inherent_gain = "1";
                     pix_clk_hz = "384000000";

                    gain_factor = "4";
                    min_gain_val = "0"; /* 0dB */
                    max_gain_val = "63"; /* 48dB */
                    step_gain_val = "1"; /* 0.3 */
                    default_gain = "0";
                    min_hdr_ratio = "1";
                    max_hdr_ratio = "1";
                    framerate_factor = "1";
                    min_framerate = "1"; /* 1.5 */
                    max_framerate = "1000"; /* 30 */
                    step_framerate = "1";
                    default_framerate= "60";
                    exposure_factor = "10";
                    min_exp_time = "1"; /* us */
                    max_exp_time = "10000"; /* us */
                    step_exp_time = "1";
                    default_exp_time = "90";/* us */
                    embedded_metadata_height = "0";
                };

Thank you for any help! I really appreciate it! @ShaneCCC @Honey_Patouceul

nvidia@nvidia-desktop:~$ gst-launch-1.0 nvarguscamerasrc exposuretimerange=“1000000 1000000” ! nvoverlaysink -e
GST_ARGUS: NvArgusCameraSrc: Setting Exposure Time Range : 1000000 1000000
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected…
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 2
Output Stream W = 1920 H = 1080
seconds to Run = 0
Frame Rate = 29.999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.

Did you implement the TEGRA_CAMERA_CID_GAIN/TEGRA_CAMERA_CID_EXPOSURE …?

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fcamera_sensor_prog.html%23wwpID0E0NO0HA

@ShaneCCC

Yes I implemented them and they are working using v4l2-ctl.
I activated extra debug prints as stated here: https://developer.ridgerun.com/wiki/index.php?title=Nvidia_Nano_IMX219_camera_messages

With this extra debug you can see (especially compared to the example on the link) that VIDEO_4_LINUX does not even try to set exposure:

[ +0,000059] video0: VIDIOC_S_FMT: type=vid-cap, width=1920, height=1080, pixelformat=BG10, field=none, bytesperline=3840, sizeimage=4147200, colorspace=8, flags=0x0, ycbcr_enc=0, quantization=0, xfer_func=0
[ +0,000026] video0: VIDIOC_REQBUFS: count=3, type=vid-cap, memory=userptr
[ +0,000050] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000012] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,001298] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=4, error_idx=3, id/val=0x9a2003/0x1, id/val=0x9a200b/0xf4240, id/val=0x9a2009/0x0, id/val=0x9a2003/0x0
[ +0,337016] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,001736] OS02C10 6-0036: OS02C10_set_exposure called with value 100 us
[ +0,006985] OS02C10 6-0036: OS02C10_set_frame_rate called with value 1000000 which translates to 1.0 fps
[ +0,220208] video0: VIDIOC_STREAMON: type=vid-cap
[ +0,009919] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000093] OS02C10 6-0036: OS02C10_set_gain called with value 13 which translates to approximately 1.6 gain_multiplication
[ +0,001698] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000015] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0xd, id/val=0x9a2003/0x0
[ +0,036059] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000574] OS02C10 6-0036: OS02C10_set_gain called with value 0 which translates to approximately 0.0 gain_multiplication
[ +0,002578] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000020] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x0, id/val=0x9a2003/0x0
[ +0,002500] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000076] OS02C10 6-0036: OS02C10_set_gain called with value 13 which translates to approximately 1.6 gain_multiplication
[ +0,002046] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000022] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0xd, id/val=0x9a2003/0x0
[ +1,795655] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000014] OS02C10 6-0036: OS02C10_set_gain called with value 15 which translates to approximately 2.1 gain_multiplication
[ +0,003559] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0xf, id/val=0x9a2003/0x0
[ +0,238728] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 17 which translates to approximately 2.3 gain_multiplication
[ +0,001435] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x11, id/val=0x9a2003/0x0
[ +0,240842] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 20 which translates to approximately 2.6 gain_multiplication
[ +0,001381] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x14, id/val=0x9a2003/0x0
[ +0,240864] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000014] OS02C10 6-0036: OS02C10_set_gain called with value 23 which translates to approximately 3.2 gain_multiplication
[ +0,001413] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000005] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x17, id/val=0x9a2003/0x0
[ +0,240848] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000014] OS02C10 6-0036: OS02C10_set_gain called with value 26 which translates to approximately 3.5 gain_multiplication
[ +0,001409] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x1a, id/val=0x9a2003/0x0
[ +0,240833] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 30 which translates to approximately 4.2 gain_multiplication
[ +0,001524] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x1e, id/val=0x9a2003/0x0
[ +0,240738] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 35 which translates to approximately 5.0 gain_multiplication
[ +0,001422] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x23, id/val=0x9a2003/0x0
[ +0,240817] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 40 which translates to approximately 5.5 gain_multiplication
[ +0,001647] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000007] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x28, id/val=0x9a2003/0x0
[ +0,240526] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 46 which translates to approximately 6.4 gain_multiplication
[ +0,001362] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000007] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x2e, id/val=0x9a2003/0x0
[ +0,240997] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000014] OS02C10 6-0036: OS02C10_set_gain called with value 53 which translates to approximately 7.4 gain_multiplication
[ +0,001372] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x35, id/val=0x9a2003/0x0
[ +0,240853] OS02C10 6-0036: OS02C10_set_group_hold called - HOLD
[ +0,000013] OS02C10 6-0036: OS02C10_set_gain called with value 57 which translates to approximately 8.1 gain_multiplication
[ +0,001294] OS02C10 6-0036: OS02C10_set_group_hold called - RELEASE
[ +0,000006] video0: VIDIOC_S_EXT_CTRLS: which=0x9a0000, count=3, error_idx=2, id/val=0x9a2003/0x1, id/val=0x9a2009/0x39, id/val=0x9a2003/0x0

You can see id=0x9a200a (exposure) not being set, while 0x9a2009 is being set (gain).

In the example on the link, both values are being set continously.

Also I tracked down ISP debug messages, and it shows this:

=== gst-launch-1.0[17150]: Connection established (7F9B1401D0)OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
---- imager: No override file found. ----
LSC: LSC surface is not based on full res!
=== gst-launch-1.0[17150]: CameraProvider initialized (0x7f94922f30)LSC: LSC surface is not based on full res!

Is this a problem?

Best regards,
jb

The mode1 and mode3 are weird

``
exposure_factor = “10”;
min_exp_time = “1”; /* us /
max_exp_time = “10000”; /
us /
step_exp_time = “1”;
default_exp_time = “90”;/
us */

Yeah they are, because they are old. But in my examples nvarguscamerasrc is running in mode0, isnt it? So it should not be a problem.

It is working now. It seems there was a mixing up with my modes. So I guess v4l2 was using my mode 0 while nvarguscamerasrc was using some other mode which I stopped updating at some point in debugging. I think that is why nvarguscamerasrc tried to set values that were not in range for v4l2 so it did not call my exposure function. I fixed it by deleting all other modes.

Still, this is strange behaviour, isn’t it?

But still thank you for any help!
Best regards,
jb