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.

TDA4VH-Q1:CSITX DEBUG

Part Number: TDA4VH-Q1


Tool/software:

I'm testing on SDK 9.2.

I want to export imx390 camera to CSITX.

I checked the images coming out through capture and viss normally.

                                         <m2m>

then checked that CSITX node appears normally, but the actual receiving image is not normal.

                                         <csitx>

What part can I debug?

  • Hi,

    How are you sending the frames via CSITX? Is it the VISS output connected to the CSITX? node? Then are you using YUV420 output format from VISS as input format to CSITX? 

    Regards,

    Brijesh 

  • Hi

    I am changing the nv12 format from viss to uyvy through m2m node and then sending it to csitx node

    Regards

    Kim

  • Hi Kim,

    ok, then which node are you using to convert from nv12 to uyvy format? or are you using VISS to output in yuv422 format? Is the yuv422 output correct? Because if it is valid, no reason for CSITX to output incorrect image? 

    Regards,

    Brijesh

  • Hi

    I wrote it as follows, referring to the CSITX Patch code.

    Is there a problem with the code?

        /* CSI-TX initialization */
        tivx_csitx_params_t local_csitx_config;
        uint32_t loopCnt;
        /* CSITX Config initialization */
        tivx_csitx_params_init(&local_csitx_config);
    
        local_csitx_config.numInst                          = 1U;
        local_csitx_config.numCh                            = 1;
        local_csitx_config.instId[0U]                       = 0;
        local_csitx_config.instCfg[0U].rxCompEnable         = (uint32_t)vx_true_e;
        local_csitx_config.instCfg[0U].rxv1p3MapEnable      = (uint32_t)vx_true_e;
        local_csitx_config.instCfg[0U].laneBandSpeed        = TIVX_CAPTURE_LANE_BAND_SPEED_360_TO_400_MBPS;
        local_csitx_config.instCfg[0U].laneSpeedMbps        = (400U);
        local_csitx_config.instCfg[0U].numDataLanes         = 4U;
        for (loopCnt = 0U ;
            loopCnt < local_csitx_config.instCfg[0U].numDataLanes ;
            loopCnt++)
        {
            local_csitx_config.instCfg[0U].lanePolarityCtrl[loopCnt] = 0u;
        }
        for (loopCnt = 0U; loopCnt < 1; loopCnt++)
        {
            local_csitx_config.chVcNum[loopCnt]   = loopCnt;
            local_csitx_config.chInstMap[loopCnt] = 0;
        }
        obj->csitx_config = vxCreateUserDataObject(obj->context, "tivx_csitx_params_t", sizeof(tivx_csitx_params_t), &local_csitx_config);
    
        /* DSS M2M initialization */
        tivx_display_m2m_params_init(&obj->display_m2m_params);
        obj->display_m2m_params.instId     = 0;
        obj->display_m2m_params.numPipe    = 1;
        obj->display_m2m_params.pipeId[0U] = 3;
        obj->display_m2m_params.overlayId  = 3;

            printf ("Enabling DSS_M2M \n");
            obj->display_m2m_output_image = vxCreateImage(obj->context, obj->width_in, obj->height_in, VX_DF_IMAGE_UYVY);
            obj->display_m2m_param_obj = vxCreateUserDataObject(obj->context, "tivx_display_m2m_params_t", sizeof(tivx_display_m2m_params_t), &obj->display_m2m_params);
            obj->displaym2mNode = tivxDisplayM2MNode(obj->graph, obj->display_m2m_param_obj, ldc_in_image, obj->display_m2m_output_image);
            if(status == VX_SUCCESS)
            {
                status = vxSetNodeTarget(obj->displaym2mNode, VX_TARGET_STRING, TIVX_TARGET_DISPLAY_M2M1);
            }
    
            if(status == VX_SUCCESS)
            {
                status = tivxSetNodeParameterNumBufByIndex(obj->displaym2mNode, 2u, obj->num_cap_buf);
            }
            obj->csitx_image_arr = vxCreateObjectArray(obj->context, (vx_reference)obj->display_m2m_output_image, num_capture_frames);
            obj->csitx_node = tivxCsitxNode(obj->graph, obj->csitx_config, obj->csitx_image_arr);
            vxSetNodeTarget(obj->csitx_node, VX_TARGET_STRING, TIVX_TARGET_CSITX);

    It consists of imx390(raw12) -> viss -> m2m -> csitx structure.

    Regards,

    Kim

  • Hi Kim,

    In below statement, are you trying to lane speed to be 400Mbps? 

    "local_csitx_config.instCfg[0U].laneSpeedMbps        = (400U);"

    Also while creating display node, what is ldc_in_image? Is it coming from LDC? But you are not using LDC, isn't it? 

    obj->displaym2mNode = tivxDisplayM2MNode(obj->graph, obj->display_m2m_param_obj, ldc_in_image, obj->display_m2m_output_image);

    Is the variable num_capture_frames set to 1?

    Regards,

    Brijesh

  • Hi

    In below statement, are you trying to lane speed to be 400Mbps? 

    Yes, I'm trying to use 400mbps.

    Also while creating display node, what is ldc_in_image? Is it coming from LDC? But you are not using LDC, isn't it? 

    ldc_in_image is an image from viss. The ldc block does not actually progress.

    Is the variable num_capture_frames set to 1?

    Yes set 1

    Regards,

    Kim

  • Even if I remove the camera while it is capturing, csitx is still sending out abnormal data.

    Is it correct that csitx will work even if I remove the camera?

  • Hi Kim,

    no, unless you have set the error frame in the capture node. if capture node does not receive frame in frame time period, it would pass this error frame to the next component. But for this to work, you would have to set this error frame in the capture node.. 

    Looking at the CSITX implementation, it does support YUV422 format. But looking at the driver, i think there might be a small change required in the driver. 

    In the API CsitxDrv_setDMACfgParams, in the file ti-processor-sdk-rtos-j721s2-evm-10_00_00_05\pdk_j721s2_10_00_00_27\packages\ti\drv\csitx\src\csitx_drvUdma.c, can you please make below highlighted change and see if it works? 

    else if ((FVID2_CSI2_DF_YUV420_10B == chObj->chCfg->outCsiDataType) ||
    (FVID2_CSI2_DF_YUV422_10B == chObj->chCfg->outCsiDataType) ||
    (FVID2_CSI2_DF_YUV422_8B == chObj->chCfg->outCsiDataType) ||
    (FVID2_CSI2_DF_RAW10 == chObj->chCfg->outCsiDataType) ||
    (FVID2_CSI2_DF_RAW12 == chObj->chCfg->outCsiDataType) ||
    (FVID2_CSI2_DF_RAW14 == chObj->chCfg->outCsiDataType) ||
    (FVID2_CSI2_DF_RAW16 == chObj->chCfg->outCsiDataType) ||
    (FVID2_CSI2_DF_RGB888 == chObj->chCfg->outCsiDataType))
    {
    chObj->dmaCfgParams.dataSizeShift =
    CSL_CSITX_DMA_DATA_SIZE_SHIFT_32BITS;
    if (FVID2_CSI2_DF_YUV422_8B == chObj->chCfg->outCsiDataType)
    {
    chObj->dmaCfgParams.dataSizeShift =
    CSL_CSITX_DMA_DATA_SIZE_SHIFT_8BITS;
    }
    if ((FVID2_CSI2_DF_RAW12 == chObj->chCfg->outCsiDataType) &&
    (FVID2_CCSF_BITS12_PACKED == chObj->chCfg->inFmt.ccsFormat))
    {
    chObj->dmaCfgParams.dataSizeShift =
    CSL_CSITX_DMA_DATA_SIZE_SHIFT_8BITS;
    }
    }

    Regards,

    Brijesh

  • Hi

    The result is the same abnormal image being output.

    The receiving fps is normal, but the video is still not normal.

    Regards,

    Kim

  • Hi Kim,

    Other than this change, i dont see anything in the CSITX driver, so back to output from DSS M2M, can you please check if DSS M2M is outputting correct YUV422 data? 

    Regards,

    Brijesh

  • Hi

        // Save display_m2m_output_image for checking CST-TX
        #ifdef USE_CSITX
        {
            snprintf(yuv_image_fname, MAX_FNAME, "%s/%s_%04d.yuv", test_data_path, "csitx", file_index);
            printf("YUV file name %s \n", yuv_image_fname);
            num_bytes_io = write_output_image_yuv422_8bit(yuv_image_fname, obj->display_m2m_output_image);
            if(num_bytes_io < 0)
            {
                printf("Error writing to CSITX file \n");
                return VX_FAILURE;
            }
        }
        #endif  // USE_CSITX

    This is the code to save the m2m output image.

    csitx_0000.zip

    Looking at the saved file, it looks like it was saved normally as uyvy.

    Did I save it wrong?

    Regards,

    Kim

  • Hi

    I put a test pattern image into the CSITX node and checked the image on the receiving side.

    It looks like the images coming from the m2m node are not being passed along properly to the cstix node.

    Regards,

    Kim

  • Hi

    Is the picture above a normal node graph?

    Regards,

    Kim

  • Hi Kim,

    Yes, i reviewed the output image from DSS M2M, that you had shared yesterday, it looks to be fine. It has size of 1936x1096 frame size and YUV422 format. Also the test pattern from CSITX seems to be correct. 

    1936x2 is also aligned to 16byte, which is expected by TIOVX framework.

    and Statistics also shows that CSITX is running fine.. 

    Can this be something on the receiving side ? Lets say it is not configured correctly and so not interpreting incoming image correctly. 

    Regards,

    Brijesh

  • Hi

    If there was a problem on the receiving side, I think I wouldn't have received the test pattern image either.

    When I sent the image saved via obj->display_m2m_output_image directly to the CSITX node, I confirmed the image on the receiving side.

    However, I will check the receiving side again.

    Is there a way to debug between the M2M node and the CSITX node?

    Regards,

    Kim

  • Hi Kim,

    But are you also sending the same frame size when using test pattern output? 

    We might have to debug at the driver level to see if the parameters are getting configured correctly. Do you happen to have CCS and JTAG connected to this board? We can put some breakpoints to see if DMA is configured correctly first. 

    Regards,

    Brijesh

  • Hi

    Yes, the test pattern is 1936x1096 uyvy format captured from gstreamer.

    Unfortunately, there is no JTAG.

    Are you suspecting the DMA side?

    Regards,

    Kim

  • Hi Kim,

    Well, i want to check if the parameters are correct for the DMA. 

    If not JTAG, can we add some prints and check the configuration? 

    This will take few iterations, but will be required. 

    Regards,

    Brijesh

  • Hi

    Which part should I check?

    Regards,

    KIm

  • Hi

    Which part should I check?

    Regards,

    KIm

  • Hi Kim,

    The API CsirxDrv_udmaRxTrpdInit in packages\ti\drv\csirx\src\csirx_drvUdma.c file prepares the DMA descriptor, so can you please all the fields from pTr and somehow get it on the UART, so that we can review them?

    Regards,

    Brijesh

  • Hi,

    Are you saying that you want to log all variables starting with pTr-> in the file?

    Regards,

    Kim

  • Hi Kim,

    Essentially i want to check below variables from this function.

    pTr->flags

    pTr->icnt0
    pTr->icnt1
    pTr->dim1

    Regards,

    Brijesh

  • Hi

    [MCU2_0]     75.004283 s: src/csitx_drvUdma.c @ Line 222: 
    [MCU2_0]     75.004313 s: TEST!!
    [MCU2_0]     75.007005 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.007040 s: pTr->flags : 52225
    [MCU2_0]     75.007059 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.007078 s: pTr->icnt0 : 3872
    [MCU2_0]     75.007095 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.007115 s: pTr->icnt1 : 1100
    [MCU2_0]     75.007132 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.007151 s: pTr->dim1 : 3872
    [MCU2_0]     75.007175 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.007196 s: pTr->flags : 52225
    [MCU2_0]     75.007213 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.007242 s: pTr->icnt0 : 3872
    [MCU2_0]     75.007259 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.007278 s: pTr->icnt1 : 1100
    [MCU2_0]     75.007295 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.007314 s: pTr->dim1 : 3872
    [MCU2_0]     75.007332 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.007351 s: pTr->flags : 52225
    [MCU2_0]     75.007368 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.007387 s: pTr->icnt0 : 3872
    [MCU2_0]     75.007403 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.007422 s: pTr->icnt1 : 1100
    [MCU2_0]     75.007439 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.007458 s: pTr->dim1 : 3872
    [MCU2_0]     75.007475 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.007495 s: pTr->flags : 52225
    [MCU2_0]     75.007512 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.007530 s: pTr->icnt0 : 3872
    [MCU2_0]     75.007547 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.007566 s: pTr->icnt1 : 1100
    [MCU2_0]     75.007583 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.007601 s: pTr->dim1 : 3872
    [MCU2_0]     75.007619 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.007638 s: pTr->flags : 52225
    [MCU2_0]     75.007655 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.007673 s: pTr->icnt0 : 3872
    [MCU2_0]     75.007690 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.007709 s: pTr->icnt1 : 1100
    [MCU2_0]     75.007726 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.007744 s: pTr->dim1 : 3872
    [MCU2_0]     75.007762 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.007781 s: pTr->flags : 52225
    [MCU2_0]     75.007798 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.007816 s: pTr->icnt0 : 3872
    [MCU2_0]     75.007833 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.007852 s: pTr->icnt1 : 1100
    [MCU2_0]     75.007868 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.007887 s: pTr->dim1 : 3872
    [MCU2_0]     75.007905 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.007924 s: pTr->flags : 52225
    [MCU2_0]     75.007941 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.007960 s: pTr->icnt0 : 3872
    [MCU2_0]     75.007976 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.007995 s: pTr->icnt1 : 1100
    [MCU2_0]     75.008011 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.008030 s: pTr->dim1 : 3872
    [MCU2_0]     75.008048 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.008067 s: pTr->flags : 52225
    [MCU2_0]     75.008084 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.008102 s: pTr->icnt0 : 3872
    [MCU2_0]     75.008119 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.008138 s: pTr->icnt1 : 1100
    [MCU2_0]     75.008155 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.008174 s: pTr->dim1 : 3872
    [MCU2_0]     75.008191 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.008210 s: pTr->flags : 52225
    [MCU2_0]     75.008230 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.008249 s: pTr->icnt0 : 3872
    [MCU2_0]     75.008265 s: src/csirx_drvUdma.c @ Line 486: 
    app_create_graph exiting
    [MCU2_0]     75.008284 s: pTr->icnt1 : 1100
    app_create_graph done
    [MCU2_0]     75.008301 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.008320 s: pTr->dim1 : 3872
    [MCU2_0]     75.008337 s: src/csirx_drvUdma.c @ Line 484: 
    [MCU2_0]     75.008356 s: pTr->flags : 52225
    [MCU2_0]     75.008373 s: src/csirx_drvUdma.c @ Line 485: 
    [MCU2_0]     75.008392 s: pTr->icnt0 : 3872
    [MCU2_0]     75.008408 s: src/csirx_drvUdma.c @ Line 486: 
    [MCU2_0]     75.008427 s: pTr->icnt1 : 1100
    [MCU2_0]     75.008444 s: src/csirx_drvUdma.c @ Line 487: 
    [MCU2_0]     75.008462 s: pTr->dim1 : 3872
        75.339560 s: ISS: Starting sensor [IMX390-MAX9295] ... !!!
    

    Is this correct?

    Regards,

    Kim

  • Hi Kim,

    This frame size looks to be fine. 3872 is essentially 1936 x 2, which means pixels are 1936 and for yuv422, it requires 2 bytes per pixel. Frame height is set to be 1100, which is not correct as per your sensor configuration, but this should have caused artifacts.

    Let me see if there are few more parameters that needs to be dumped. 

    Regards,

    Brijesh

  • Hi,

    Is there anything else I should check?

    Regards,

    Kim

  • Not yet, still trying to figure out what can cause issue for YUV422 mode.

    Btw, can you also please check if there is nothing missing on receiving side? 

    Regards,

    Brijesh

  • Hi

    Let me check.

    Is there any way to send test patterns from the csitx ip block?

    Regards,

    Kim

  • Hi,

    Should CSIRX BANDSPEED and CSITX BANDSPEED remain the same?

    Regards,

    Kim

  • Hi,

    It works if you change the method as follows.

    I assigned the csitx_image_arr array to display_m2m_output_image.

            obj->display_m2m_output_image = (vx_image)vxGetObjectArrayItem(obj->csitx_image_arr, 0);
    

    Is there any problem with the configuration as above?

    Regards,

    Kim

  • Hi Kim,

    Yes, this is correct method. You are creating image object array for CSITX input and taking index0 for the dss m2m node. Please use this method. 

    Regards,

    Brijesh

  • Hi

    This wasn't available in 8.x patch, what's different about 9.x?

    Regards,

    Kim

  • Hi Kim,

    This is a standard method in all releases, nothing related to 8.x release. 

    Regards,

    Brijesh