This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] How can I change the sensor parameters using v4l2-ctl?

Part Number: AM62A7

Tool/software:

I want to use v4l2-ctl to change sensor parameters at run time, but the command "v4l2-ctl -d /dev/videoX --list-ctrls" returns nothing. What's the right command?

  • The /dev/videoX nodes associated with the CSI2-RX are just video capture devices used to allocate, enqueue and dequeue frame buffers and start the DMA transfer. They are not directly associated with the sensor. There are no controls required from the user space for these nodes. Therefore, "v4l2-ctl -d /dev/videoX --list-ctrls" won't return anything.

    For example, on AM62A, there are 6 video nodes under j721e-csi2rx (the CSI2-RX driver), and none of these nodes has any controls from the user space:

    root@am62axx-evm:~# v4l2-ctl --list-devices
    j721e-csi2rx (platform:30102000.ticsi2rx):
            /dev/video3
            /dev/video4
            /dev/video5
            /dev/video6
            /dev/video7
            /dev/video8
            /dev/media0
    
    wave5-dec (platform:30210000.video-codec):
            /dev/video0
            /dev/video1
    
    e5010 (platform:fd20000.jpeg-encoder):
            /dev/video2
    
    root@am62axx-evm:~# v4l2-ctl -d /dev/video3 --list-ctrls
    root@am62axx-evm:~# v4l2-ctl -d /dev/video4 --list-ctrls
    root@am62axx-evm:~#

    To control the parameters of a sensor, the /dev/v4l-subdevX node created by the sensor driver should be used instead. To find the right subdev number, run command "media-ctl -p -d /dev/mediaX" where /dev/mediaX is the media device node created by the CSI2-Rx driver. For example, below is what should be displayed for IMX219 on AM62A:

    root@am62axx-evm:~# media-ctl -p -d/dev/media0
    
    ...
    
    - entity 15: imx219 4-0010 (1 pad, 1 link, 0 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            pad0: Source
                    [stream:0 fmt:SRGGB8_1X8/1920x1080 field:none colorspace:raw xfer:none quantization:full-range
                     crop.bounds:(8,8)/3280x2464
                     crop:(688,700)/1920x1080]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    ...

    Then use the sensor's subdev node to change parameters:

    root@am62axx-evm:~# v4l2-ctl -d /dev/v4l-subdev2 --list-ctrls
    
    User Controls
    
                           exposure 0x00980911 (int)    : min=4 max=1759 step=1 default=1600 value=1600
                    horizontal_flip 0x00980914 (bool)   : default=0 value=0 flags=modify-layout
                      vertical_flip 0x00980915 (bool)   : default=0 value=0 flags=modify-layout
    
    ...
    
    root@am62axx-evm:~# v4l2-ctl -d /dev/v4l-imx219-subdev0 --set-ctrl exposure=40
    
    root@am62axx-evm:~# v4l2-ctl -d /dev/v4l-imx219-subdev0 --set-ctrl digital_gain=4095
    

    For other common problems related to CSI camera, please refer to this FAQ: