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.

AM62A7: imx219 camera testing

Part Number: AM62A7


Hi,

We are testing imx219 camera sensor with AM62A7 SOC based custom board.

After booting linux BSP camera is detected and fixed to 1080p resolution using init scripts.

Camera streaming is working properly for 1080p resolution with below gstreamer pipeline

gst-launch-1.0 v4l2src device=/dev/video2 io-mode=5 ! video/x-bayer,width=1920,height=1080,format=bggr ! \
tiovxisp sensor-name=SENSOR_SONY_IMX219_RPI dcc-isp-file=/opt/imaging/imx219/dcc_viss_1920x1080.bin \
sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_1920x1080.bin sink_0::device=/dev/v4l-subdev2 ! \
video/x-raw,format=NV12 ! kmssink driver-name=tidss sync=false

How to test imx219 camera with different resolutions (1280x720, 640x480, and other)?

  • Hello Vinay,

    Firstly, you need to find out what resolutions are supported by the sensor driver. Please refer to the AM62A Academy - Use Camera and go to "Query a CSI-2 Image Sensor". You'll find out the following resolutions are supported by the IMX219 driver:

    root@am62axx-evm:~# v4l2-ctl -d /dev/v4l-subdev2 --list-subdev-mbus-codes pad=0
    ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0,stream=0)
            0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
            0x3014: MEDIA_BUS_FMT_SRGGB8_1X8
    root@am62axx-evm:~# v4l2-ctl -d /dev/v4l-subdev2 --list-subdev-framesizes pad=0,code=0x3014
    ioctl: VIDIOC_SUBDEV_ENUM_FRAME_SIZE (pad=0,stream=0)
            Size Range: 3280x2464 - 3280x2464
            Size Range: 1920x1080 - 1920x1080
            Size Range: 1640x1232 - 1640x1232
            Size Range: 640x480 - 640x480
    

    Secondly, you need to check if there are available pre-tuned ISP configurations for a specific resolution. For IMX219, the out-of-box ISP configurations are listed below:

    root@am62axx-evm:~# ls /opt/imaging/imx219 -l
    total 528
    -rw-r--r-- 1 root root 22951 Mar  9  2018 dcc_2a_1280x720.bin
    -rw-r--r-- 1 root root 22951 Mar  9  2018 dcc_2a_1640x1232.bin
    -rw-r--r-- 1 root root 22951 Mar  9  2018 dcc_2a_1920x1080.bin
    -rw-r--r-- 1 root root 22951 Mar  9  2018 dcc_2a_320x240.bin
    -rw-r--r-- 1 root root 22951 Mar  9  2018 dcc_2a_640x480.bin
    

    Finally, you can configure the IMX219 to a specific resolution and run the streaming. For example,

    root@am62axx-evm:~# media-ctl -V '"imx219 4-0010":0 [fmt:SRGGB8_1X8/640x480 field:none]'
    root@am62axx-evm:~# gst-launch-1.0 v4l2src device=/dev/video2 io-mode=5 ! \
    video/x-bayer,width=640,height=480,format=bggr ! \
    tiovxisp sensor-name=SENSOR_SONY_IMX219_RPI dcc-isp-file=/opt/imaging/imx219/dcc_viss_640x480.bin \
    sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_640x480.bin sink_0::device=/dev/v4l-subdev2 ! \
    video/x-raw,format=NV12, width=640, height=480 ! \
    kmssink driver-name=tidss sync=false

    Regards,

    Jianzhong

  • Hello Jianzhong,

    tested 1080p and 640p and stream works properly but for 1640x1232 it shows below error.
    root@am62axx-evm:/opt/edgeai-gst-apps# media-ctl -V '"imx219 2-0010":0 [fmt:SRGGB8_1X8/1640x1232 field:none]'
    root@am62axx-evm:/opt/edgeai-gst-apps# gst-launch-1.0 v4l2src device=/dev/video2 io-mode=5 ! \
    > video/x-bayer,width=1640,height=1232,format=bggr ! \
    > tiovxisp sensor-name=SENSOR_SONY_IMX219_RPI dcc-isp-file=/opt/imaging/imx219/dcc_viss_1640x1232.bin \
    > sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_1640x1232.bin sink_0::device=/dev/v4l-subdev2 ! \
    > video/x-raw,format=NV12, width=1640, height=1232 ! \
    > kmssink driver-name=tidss sync=false
    APP: Init ... !!!
    MEM: Init ... !!!
    MEM: Initialized DMA HEAP (fd=5) !!!
    MEM: Init ... Done !!!
    IPC: Init ... !!!
    IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
       844.467970 s: GTC Frequency = 200 MHz
    APP: Init ... Done !!!
       844.468068 s:  VX_ZONE_INIT:Enabled
       844.468079 s:  VX_ZONE_ERROR:Enabled
       844.468088 s:  VX_ZONE_WARNING:Enabled
       844.468817 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
       844.469253 s:  VX_ZONE_INIT:[tivxHostInitLocal:93] Initialization Done for HOST !!!
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
    Additional debug info:
    ../gstreamer-1.16.3/libs/gst/base/gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming stopped, reason not-negotiated (-4)
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to NULL ...

    (gst-launch-1.0:2087): GStreamer-CRITICAL **: 10:34:45.043: gst_caps_get_structure: assertion 'index < GST_CAPS_LEN (caps)' failed

    (gst-launch-1.0:2087): GStreamer-CRITICAL **: 10:34:45.043: gst_structure_get_int: assertion 'structure != NULL' failed
    Freeing pipeline ...
       844.498524 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:107] De-Initialization Done for HOST !!!
       844.499771 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
    APP: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... Done !!!
    IPC: Deinit ... !!!
    IPC: DeInit ... Done !!!
    MEM: Deinit ... !!!
    DDR_SHARED_MEM: Alloc's: 0 alloc's of 0 bytes
    DDR_SHARED_MEM: Free's : 0 free's  of 0 bytes
    DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes
    DDR_SHARED_MEM: Total size: 184549376 bytes
    MEM: Deinit ... Done !!!
    APP: Deinit ... Done !!!

    for 3280x2464 resolution pre-tuned ISP configurations is not available in rootfs.

    also stream is working only for MEDIA_BUS_FMT_SRGGB8_1X8 format but when set to MEDIA_BUS_FMT_SRGGB10_1X10 stream doesnot start.
    below commands are used to switch resolution and MEDIA_BUS_FMT_SRGGB10_1X10 format
    media-ctl -V '"imx219 2-0010":0 [fmt:SRGGB10_1X10/1280x1080 field:none]'

    gst-launch-1.0 v4l2src device=/dev/video2 io-mode=5 ! video/x-bayer,width=1920,height=1080,format=bggr ! \
    tiovxisp sensor-name=SENSOR_SONY_IMX219_RPI dcc-isp-file=/opt/imaging/imx219/dcc_viss_10b_1920x1080.bin \
    sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_10b_1920x1080.bin sink_0::device=/dev/v4l-subdev2 ! \
    video/x-raw,format=NV12 ! kmssink driver-name=tidss sync=false


    1. how to stream camera with 1640x1232 resolution and MEDIA_BUS_FMT_SRGGB10_1X10 format
    2. is there any pre-tuned ISP configuration for 3280x2464 resolution

  • Hello Vinay,

    It seems there are some issues with 1640x1232 and 8-bit. I reproduced that problem and will be looking into this issue.

    1. how to stream camera with 1640x1232 resolution and MEDIA_BUS_FMT_SRGGB10_1X10 format

    For 1640x1232/1920x1080 and 10-bit, it's working for me:

    root@am62axx-evm:~# media-ctl -V '"imx219 4-0010":0 [fmt:SRGGB10_1X10/1640x1232 field:none]'
    root@am62axx-evm:~# gst-launch-1.0 -v v4l2src device=/dev/video2 io-mode=dmabuf-import ! video/x-bayer, width=1640, height=1232, framerate=30/1, format=rggb10 ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_SONY_IMX219_RPI" dcc-isp-file=/opt/imaging/imx219/dcc_viss_10b_1640x1232.bin sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_10b_1640x1232.bin format-msb=9 ! video/x-raw, format=NV12, width=1640, height=1232, framerate=30/1 ! kmssink driver-name=tidss
    root@am62axx-evm:~# media-ctl -V '"imx219 4-0010":0 [fmt:SRGGB10_1X10/1920x1080 field:none]'
    root@am62axx-evm:~# gst-launch-1.0 -v v4l2src device=/dev/video2 io-mode=dmabuf-import ! video/x-bayer, width=1920, height=1080, framerate=30/1, format=rggb10 ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_SONY_IMX219_RPI" dcc-isp-file=/opt/imaging/imx219/dcc_viss_10b_1920x1080.bin sink_0::dcc-2a-file=/opt/imaging/imx219/dcc_2a_10b_1920x1080.bin format-msb=9 ! video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 ! kmssink driver-name=tidss
    
    

    Please note that you'll need to use rggb10 instead of rggb.

    2. is there any pre-tuned ISP configuration for 3280x2464 resolution

    There is no pre-tuned ISP configuration for 3280x2464.

    Regards,

    jianzhong

  • Hello Vinay,

    The reason that the GStreamer pipeline failed for 1640x1232 with raw 8-bit input is that GStreamer expects the frame width in bytes to be a multiple of 16. Since 1640-byte is not a multiple of 16, the pipeline failed. On the other hand, for raw 10-bit, we use a 16-bit container, and 1640*2-byte is a multiple of 16 and thus the pipeline works fine.

    Therefore, this behavior is expected.

    Regards,

    Jianzhong

  • Hi,

    We were checking imx219 datasheet and checked imx219 camera supports 4 lanes but currently working with only 2 lanes since linux driver supports only 2 lanes

    So patched the linux driver with below patch available 

    https://patchwork.kernel.org/project/linux-media/patch/20220412135534.2796158-3-aford173@gmail.com/

    But after setting to 4lanes camera streaming is not working anymore and stream does not start in the display.

    Is there any patch available for supporting 4lanes also since we use the isp configuration file for streaming.

    Is there any seperate isp configuration file for 4lanes or does the given isp configuration files in BSP support both 2 and 4 lanes?

  • Hello Vinay,

    We haven't tried this patch. When you applied that patch, did you also update the device tree accordingly: arch/arm64/boot/dts/ti/k3-am62a7-sk-csi2-imx219.dts?

    The ISP processes the raw data provided by the sensor driver. The number of CSI data lanes is transparent to the ISP. So the ISP configuration files provided in the SDK support both 2-lane and 4-lane configurations.

    Regards,

    Jianzhong

  • Hi,

    Yes updated the device tree data lanes property to 4 lanes and link frequency to 755mhz but still camera is not streaming

  • Which camera module are you using? Does it have a connector that populates all 4 data lanes?