RZ-V2H unable to capture camera data using sample app for second camera (/dev/video1fr)

Hi ,

2 cameras are connected to RZ-V2H which are enumerated as " /dev/video0fr "   and   "/dev/video1fr"  as described in document RZ/V2H ISP Support Package Sample Application Note R01AN7210EJ0110.pdf.

1) execute sample-app for /dev/video0fr , i am able to see the captured 8 frames dumped in /tmp directory.

2)  executing sample application using below command for  "dev/video1fr"  it fails to provide any output and no error is seen in the command prompt.

Sample application program seems to be running infinitely and no output in seen /tmp directory. Please guide on possible cause.

root@rzv2h-evk-ver1:~# ./sample-app /dev/video1fr
sample-app v1.1.1
output_mode = 0
port = 22222
output_prefix = [/tmp/]
fps = 30, network_fps = 1
width = 3840, height = 2160, fourcc = [YUY2]
8 buffer, 8 frames, batch_mode = 0, nb_buffer = 8
one_frame_length 16588800

Regards,

chekr

  • Hi chekr,
    Have you built the image from source?
    Did you use any AI SDK ready image?
    What image camera sensors are you using?
    Can you share your v4l-init.sh file?
    You can have a look on this RZ/V2H and RZ/V2N BSP Manual Set (RTK0EF0045Z94001AZJ-v1.0.3.zip) (document: r01us0704ej0104-rzv2h_rzv2n_Camera_UME.pdf), first.
    Kind Regards.

  • Hi ,

    Thank you for reply.

    I have built the image from source . IMX415 image sensors is used with RZV2H board. 

    Please check v4l-init.txt  file . File is renamed to .txt 

    Output of the v4l2-init.sh is as below.

    In parallel , i  will check file r01us0704ej0104-rzv2h_rzv2n_Camera_UME.pdf from the zip folder that you have shared.

    Best Regards,

    chekr

    #!/bin/sh
    mode=$1
    scriptname=`basename $0`
    log() {
        echo "$scriptname: $@"
    }
    
    run_userspace_driver() {
        ps | grep mali_iv021_is[p] | awk '{print $1}' | xargs kill 2> /dev/null
        if [ -c /dev/video1fr ]; then
            mali_iv021_isp.elf &
        else
            mali_iv021_isp-single.elf &
        fi
    }
    
    
    calc_selection() {
        : ${width:=$1}
        : ${height:=$2}
        : ${effective_width:=$3}
        : ${effective_height:=$4}
        : ${top:=$(((height-effective_height)/2))}
        : ${left:=$(((width-effective_width)/2))}
    }
    errend() {
        echo $1
        exit 1
    }
    
    check_selection() {
        err=""
        [ $width -le 0 ] && err="width <= 0\n$err"
        [ $height -le 0 ] && err="height <= 0 $$err"
        [ $effective_height -le 0 ] && err="effective_height <= 0\n$err"
        [ $effective_width -le 0 ] && err="effective_width <= 0\n$err"
        [ $top -lt 0 ] && err="top < 0\n$err"
        [ $left -lt 0 ] && err="left < 0\n$err"
        if [ "$err" != "" ]; then
            echo "selection error."
            echo -ne $err
            exit 1
        fi
    }
    
    case "$1" in
        2k)
            calc_selection 1932 1088 1920 1080
            preset=2
            ;;
        dol)
            calc_selection 3864 2176 3840 2160
            preset=4
            ;;
        hdr)
            calc_selection 3864 2176 3840 2160
            preset=6
            ;;
        *)
            calc_selection 3864 2176 3840 2160
            preset=0
            ;;
    esac
    
    log "preset=$preset, ($width, $height) => ${effective_width}x${effective_height}+$left+$top"
    check_selection
    
    fmt="fmt:SBGGR12_1X12/${width}x${height} field:none"
    for m in 0 1; do
        if [ ! -c /dev/video${m}fr ]; then
            continue;
        fi
        csi2=""
        sensor=""
        cru=""
        while read entity; do
            case "$entity" in
                rzg2l_csi2*) csi2="$entity" ;;
                imx415*) sensor="$entity" ;;
                CRU*) cru="$entity" ;;
            esac
        done <<EOT
    `media-ctl -p -d /dev/media$m | sed -ne 's/- entity [0-9]*: \(.*\) (.*$/\1/p'`
    EOT
        if [ "$csi2" != "" ] && [ "$sensor" != "" ] && [ "$cru" != "" ]; then
            media-ctl -d /dev/media$m -r
            media-ctl -d /dev/media$m -V "'$csi2':1 [$fmt]"
            media-ctl -d /dev/media$m -V "'$sensor':0 [$fmt]"
            media-ctl -d /dev/media$m -l "'$csi2':1 -> '$cru':0 [1]"
            media-ctl -d /dev/media$m -l "'$sensor':0 -> '$csi2':0 [1]"
            v4l2-ctl -d `media-ctl -d /dev/media$m -e "$cru"` --set-fmt-video=width=$width,height=$height,pixelformat=BG12
        fi
        v4l2-ctl -d /dev/video${m}fr -c isp_sensor_preset=$(($preset+$m))
    done
    sleep 0.5
    devices=""
    for m in 0 1; do
        if [ ! -c /dev/video${m}fr ]; then
            continue;
        fi
        devices="$devices /dev/video${m}fr"
        for t in `seq 0 10`; do
            v4l2-ctl -d /dev/video${m}fr --set-selection target=crop,left=$left,top=$top,width=$effective_width,height=$effective_height
            if [ "`v4l2-ctl -d /dev/video${m}fr --get-selection target=crop | awk '{print $6$8$10$12}'`" = "$left,$top,${effective_width},${effective_height}," ]; then
                break
            fi
            if [ "$t" -eq 10 ]; then
                log "failed to set selections."
                break
            fi
            sleep 0.01
        done
    done
    
    run_dummy_sample_app() {
        (
            echo q | ./sample-app $devices -w $effective_width -h $effective_height > /dev/null 2>&1 &
            pid=$!
            (
                sleep 3
                kill $pid > /dev/null 2>&1  /dev/null
            ) > /dev/null 2>&1 &
            pid2=$!
            wait $pid > /dev/null 2>&1
            status=$?
            kill $pid2 > /dev/null 2>&1
            [ $status -eq 0 ] && break
            if [ "$t" -eq 10 ]; then
                log "failed to prepare streaming."
            else
                log "Ok."
            fi
        )
    }
    
    run_dummy_gstreamer() {
        (
            exec > /dev/null
            exec 2> /dev/null
            gst-launch-1.0 -v v4l2src device=/dev/video1fr ! fakesink > /dev/null 2>&1 &
            pid3=$!
            sleep 1
            kill $pid3
        )
    }
    
    for i in 1 2; do
        run_dummy_sample_app
        run_dummy_gstreamer
    done
    
    run_userspace_driver
    run_dummy_sample_app
    
    log "done."
    exit 0
    

  • Have you set the Camera Module Switches to Master and Slave. Also the modules need to be connected together. Make sure the master is connected to CN7 and slave is connected to CN8.
    IMX415 Board for RZ/V2H Evaluation Board Kit

  • Hi michael,

    Yes, IMX415 Camera Modules are set to Master (CN7) and slave(CN8) and connected together  .Please check attached image.

    Switch Setting (RZ/V2H Evaluation Board Kit) for JSW1 and DSW3 are set as per document.

    I still don't see any data on /dev/video1fr.

    Could you please suggest if there is any mistake in the switch setting or connector connection. ?

    In order to check if both the IMX415 camera module are working  , I tried connecting  IMX415 module to CN7 one at a time and /dev/video0fr data is streaming.

    Regards,

    chekr

    IMX415 camera in Master Slave mode

  • Hi ,

    Enabled logs in v4l2-init script to get information and based on document: r01us0704ej0104-rzv2h_rzv2n_Camera_UME.pdf executed below commands for /dev/media1.

    media-ctl -d /dev/media1 -r

    media-ctl -d /dev/media1 -l "'rzg2l_csi2 16010400.csi21':1 -> 'CRU output':0 [1]"

    media-ctl -d /dev/media1 -V "'rzg2l_csi2 16010400.csi21':1 [fmt:SBGGR12_1X12/3864x2176 field:none]"
    media-ctl -d /dev/media1 -V "'imx415 1-001a':0 [fmt:SBGGR12_1X12/3864x2176 field:none]"

    Executed  ./sample-app /dev/video1fr  and see that the application is in infinite loop and no data is seen in network stream.

    media-ctl -d /dev/media1 -r

    root@rzv2h-evk-ver1:~# media-ctl -d /dev/media0 -p
    Media controller API version 5.10.145
    
    Media device information
    ------------------------
    driver          rzg2l_cru
    model           renesas,cru-r9a09g057
    serial
    bus info        platform:16000000.cru0
    hw revision     0x0
    driver version  5.10.145
    
    Device topology
    - entity 1: rzg2l_csi2 16000400.csi20 (5 pads, 5 links)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
            pad0: Sink
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    <- "imx415 0-001a":0 [ENABLED]
            pad1: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 [ENABLED]
            pad2: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 []
            pad3: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 []
            pad4: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 []
    
    - entity 7: imx415 0-001a (1 pad, 1 link)
                type V4L2 subdev subtype Sensor flags 0
                device node name /dev/v4l-subdev1
            pad0: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none colorspace:raw xfer:none]
                    -> "rzg2l_csi2 16000400.csi20":0 [ENABLED]
    
    - entity 15: CRU output (1 pad, 4 links)
                 type Node subtype V4L flags 0
                 device node name /dev/video0
            pad0: Sink
                    <- "rzg2l_csi2 16000400.csi20":1 [ENABLED]
                    <- "rzg2l_csi2 16000400.csi20":2 []
                    <- "rzg2l_csi2 16000400.csi20":3 []
                    <- "rzg2l_csi2 16000400.csi20":4 []
    
    
    
    root@rzv2h-evk-ver1:~# media-ctl -d /dev/media1 -p
    Media controller API version 5.10.145
    
    Media device information
    ------------------------
    driver          rzg2l_cru
    model           renesas,cru-r9a09g057
    serial
    bus info        platform:16010000.cru1
    hw revision     0x0
    driver version  5.10.145
    
    Device topology
    - entity 1: rzg2l_csi2 16010400.csi21 (5 pads, 5 links)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev2
            pad0: Sink
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    <- "imx415 1-001a":0 [ENABLED]
            pad1: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 [ENABLED]
            pad2: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 []
            pad3: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 []
            pad4: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none]
                    -> "CRU output":0 []
    
    - entity 7: imx415 1-001a (1 pad, 1 link)
                type V4L2 subdev subtype Sensor flags 0
                device node name /dev/v4l-subdev3
            pad0: Source
                    [fmt:SBGGR12_1X12/3864x2176 field:none colorspace:raw xfer:none]
                    -> "rzg2l_csi2 16010400.csi21":0 [ENABLED]
    
    - entity 15: CRU output (1 pad, 4 links)
                 type Node subtype V4L flags 0
                 device node name /dev/video1
            pad0: Sink
                    <- "rzg2l_csi2 16010400.csi21":1 [ENABLED]
                    <- "rzg2l_csi2 16010400.csi21":2 []
                    <- "rzg2l_csi2 16010400.csi21":3 []
                    <- "rzg2l_csi2 16010400.csi21":4 []
    
    root@rzv2h-evk-ver1:~#

  • Hi chekr,
    Can you please try /dev/video1fr with gstreamer?
    You can take a look on this RZ/V2H Group and RZ/V2N Group Linux Interface Specification GStreamer User's Manual: Software Appendix D How to Detect Active Camera.
    Kind Regards.

  • One point the Camera Vendor CSM.SOL has the camera driver configured as master slave. So the slave camera cannot run with out the master running. Please try the both gstreamer commands.

    gst-launch-1.0 v4l2src device=/dev/video0fr ! waylandsink -v position-x=0   position-y=550 out-w=960 out-h=540 & \

    gst-launch-1.0 v4l2src device=/dev/video1fr ! waylandsink -v position-x=960 position-y=550 out-w=969 out-h=540 &
    This will start both cameras.

    Also you need to run the v4l2-init.sh script first.

  • Hi michael, PT_Renesas ,

    Thanks for pointing out that slave camera cannot run "without" master running.

    I tried ./sample-app  /dev/video0fr /dev/video1fr  and both the camera is streaming to network and can check the output using ffplay.