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.

TDA4VM: CSI2-TX: Setup for 1920x720@25fps UYVY, but the rx side decode error

Part Number: TDA4VM

Hi TI Experts

Platform: Ver0.7.03

A csitx demo for 1920x720@25fps with format UYVY, I send data by the function app_csitx_create_graph_1920_0720_25P( in the below code block).

But the rx side report the decode error.

I have two questions:

1. Is the function below correct? I use the similar function for 1920x1080@25fps with format UYVY, and it can transferred successful.

2. Could you please tell me the method to dump the frames to verify whether the frames correct?

static vx_status app_csitx_create_graph_1920_0720_25P(AppCsitxObj *obj)
{
    vx_status                   status = VX_SUCCESS;
    uint32_t                    frmIdx = 0;
    uint32_t                    loopCnt = 0;
    vx_image                    tx_frame_array_item = NULL;

    VX_PRINT(VX_ZONE_INFO, "Creating graph \n");
    /* Create graph */
    obj->graph = vxCreateGraph(obj->context);
    if(status == VX_SUCCESS)
    {
        VX_PRINT(VX_ZONE_INFO, "Creating graph done\n");
        status = vxGetStatus((vx_reference) obj->graph);
    }
    
    obj->rect.start_x = IMAGE_POSI_START_X;
    obj->rect.start_y = IMAGE_POSI_START_Y;
    obj->rect.end_x = IMAGE_POSI_1920_720_END_X;
    obj->rect.end_y = IMAGE_POSI_1920_720_END_Y;

    /* set init value of all parameters */
    obj->csitx_image = vxCreateImage(obj->context, obj->rect.end_x, obj->rect.end_y, CSITX_FORMAT);
    if (obj->csitx_image == NULL)
    {
        VX_PRINT(VX_ZONE_ERROR, "%s[%d]csitx_image cretae failed\n", __FUNCTION__, __LINE__);
    }

    /* create the parameter list */
    /* allocate Input and Output refs*/
    obj->csitx_frame_obj = vxCreateObjectArray(obj->context, (vx_reference)obj->csitx_image, NUM_CHANNELS);
    if (obj->csitx_frame_obj == NULL)
    {
        VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_frame_obj create failed\n", __FUNCTION__, __LINE__);
    }

    /* this is currently supported for UYVY formats only */
    /* initialization of frames for each channel with unique pattern
       it is (channel no. + x) */
    VX_PRINT(VX_ZONE_INFO,"Initializing Transmit Buffers...\n");
    for (frmIdx = 0U ; frmIdx < NUM_CHANNELS ; frmIdx++)
    {
        tx_frame_array_item = (vx_image)vxGetObjectArrayItem(obj->csitx_frame_obj , frmIdx);
        if (tx_frame_array_item == NULL)
        {
            VX_PRINT(VX_ZONE_ERROR,"%s[%d]vx_frame_array_item create failed\n", __FUNCTION__, __LINE__);
        }
        else
        {
            VX_PRINT(VX_ZONE_INFO, "vxGetObjectArrayItem success\n");
        }
        app_csitx_load_vximage_from_yuvfile(tx_frame_array_item, IMAGE_1920x720_UYVY);
        status = vxReleaseImage(&tx_frame_array_item);
        if(status != VX_SUCCESS)
        {
            VX_PRINT(VX_ZONE_ERROR, "%s[%d] tx_frame_array_item Release failed\n", __FUNCTION__, __LINE__);
        }
    }
    VX_PRINT(VX_ZONE_INFO, "Initializing Transmit Buffers Done.\n");

    /* CSITX Config initialization */
    tivx_csitx_params_init(&obj->csitx_config);
    obj->csitx_config.numInst                          = 1U;
    obj->csitx_config.numCh                            = NUM_CHANNELS;
    obj->csitx_config.instId[0U]                       = CSITX_INST_ID;
    obj->csitx_config.instCfg[0U].rxCompEnable         = (uint32_t)vx_true_e;
    obj->csitx_config.instCfg[0U].rxv1p3MapEnable      = (uint32_t)vx_true_e;
    obj->csitx_config.instCfg[0U].laneBandSpeed        = TIVX_CSITX_LANE_BAND_SPEED_120_TO_160_MBPS;
    obj->csitx_config.instCfg[0U].numDataLanes         = 4U;
    for (loopCnt = 0U;
        loopCnt < obj->csitx_config.instCfg[0U].numDataLanes ;
        loopCnt++)
    {
        obj->csitx_config.instCfg[0U].lanePolarityCtrl[loopCnt] = 0u;
    }
    for (loopCnt = 0U; loopCnt < NUM_CHANNELS; loopCnt++)
    {
        obj->csitx_config.chVcNum[loopCnt]   = loopCnt;
        obj->csitx_config.chInstMap[loopCnt] = CSITX_INST_ID;
    }

    VX_PRINT(VX_ZONE_INFO, "start to call vxCreateUserDataObject\n");
    obj->csitx_config_obj = vxCreateUserDataObject(obj->context, "tivx_csitx_params_t", sizeof(tivx_csitx_params_t), &obj->csitx_config);
    if (obj->csitx_config_obj == NULL)
    {
        VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_config create failed\n", __FUNCTION__, __LINE__);
    }
    
    VX_PRINT(VX_ZONE_INFO, "Start to call tivxCsitxNode\n");
    obj->csitx_node = tivxCsitxNode(obj->graph, obj->csitx_config_obj, obj->csitx_frame_obj);
    if (obj->csitx_node == NULL)
    {
        VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_node create failed\n", __FUNCTION__, __LINE__);
    }

    VX_PRINT(VX_ZONE_INFO, "Start to call vxSetNodeTarget\n");
    status = vxSetNodeTarget(obj->csitx_node, VX_TARGET_STRING, TIVX_TARGET_CSITX);
    if (status != VX_SUCCESS)
    {
        VX_PRINT(VX_ZONE_ERROR, "%s[%d] TIVX_TARGET_CSITX set failed\n", __FUNCTION__, __LINE__);
    }

    /* input @ node index 0, becomes csitx_graph parameter 1 */
    VX_PRINT(VX_ZONE_INFO, "Start to call add_graph_parameter_by_node_index\n");
    add_graph_parameter_by_node_index(obj->graph, obj->csitx_node, 1);

    VX_PRINT(VX_ZONE_INFO, "Start to run vxVerifyGraph\n");
    status = vxVerifyGraph(obj->graph);
    if (status != VX_SUCCESS)
    {
        VX_PRINT(VX_ZONE_ERROR, "%s[%d] csitx_graph verified failed\n", __FUNCTION__, __LINE__);
    }

    VX_PRINT(VX_ZONE_INFO, "app_create_graph exiting\n");
    return status;
}

best wishes

Chengwu.Tang

  • Hi Chengwu.Tang

    1. Is the function below correct? I use the similar function for 1920x1080@25fps with format UYVY, and it can transferred successful.

    If the same code works fine for 1920x1080@25 fps, i see no reason for it not to work for 1920x720@25fps. The change in height should not affect the output. 

    One question here, is the lane speed correct? 1920x1080 would around 200Mbps per lane. I see you are using 120 to 160Mbps, is it supported by receiver for YUV422 format? 

    2. Could you please tell me the method to dump the frames to verify whether the frames correct?

    You could check the buffer before sending it to the CSITX. Please look into the function app_csitx_load_vximage_from_yuvfile. It must be mapping the buffer to copy yuv file.. You could do similar to dump/save frames. 

    Regards,

    Brijesh

  • Hi, Brijesh

    One question here, is the lane speed correct? 1920x1080 would around 200Mbps per lane. I see you are using 120 to 160Mbps, is it supported by receiver for YUV422 format? 

    You are correct, I set the laneBandSpeed to CSITX_LANE_BAND_SPEED_200_TO_240_MBPS for 1920x1080.

    You could check the buffer before sending it to the CSITX. Please look into the function app_csitx_load_vximage_from_yuvfile. It must be mapping the buffer to copy yuv file.. You could do similar to dump/save frames. 

    Sorry, maybe there is a mis-understanding between us.

    I'd like to check the data after send out by csitx, not before send to csitx. Is there any way to check it.

    best wishes

    Chengwu.Tang

  • Hi Chengwu.Tang,

    I'd like to check the data after send out by csitx, not before send to csitx. Is there any way to check it.

    No, CSITX cannot write back the data, which is sent out. We need to use some receiver only to verify data. 

    Regards,

    Brijesh

  • Hi Brijesh

    I have captured the Frame Synchronization Packets of the 1920x720( the clock cycle is 13.36ns), and found that the format of SP is in-correct:

    ①part of the "HS Sync-Sequeence" : “00011101”(the red color), 32.80ns

    ②the time of SP: 53.76ns

    According to the above measurement, we can see that the Time(HS-Sync ) is almost equals to the Time(SP).

    But the calculation of the Time(SP) =  13.36 * 32 / 2 = 213.76ns ≈ 53.76 * 4 

    Could you please confirm it?

    best wishes

    Chengwu.Tang

  • Hi Chengwu Tang,

    I will require help from HW team here. Looping in to this thread.

    Regards,

    Brijesh

  • Chengwu,

    Please increase the resolution on the captures and also include the CLK lane. A few questions:

    1. Are you capturing on DAT0?

    2. Is this the only frame transmitted by the device?

    3. What is the error flag shown on the receiving sensor? 

    Thanks & Regards,

    Shiou Mei

  • Hello, Shiou Mei

    Update the answers and update the captures:

    The clock lane: 133.6 / 10 = 13.36ns

    The answers are below

    1. Are you capturing on DAT0?

    ->Yes, I captured it on Data lane0.

    2. Is this the only frame transmitted by the device?

    ->No, Just one of the frames transferred. But all the frames are the same.

    3. What is the error flag shown on the receiving sensor? 

    ->The rx side is the Qualcomm SA8155, and the error flag is decode error.

    best wishes 

    Chengwu.Tang

  • Chengwu,

    Based on your waveform capture, it does look like the subsequent frames are toggling longer than the current frame, so they seem to correlate to HS-data. Can you sanity check on the scope?

    Moreover, please show the CLK and the DAT signal on the same scope capture so we can count the bits accurately. Are there any lane speed control registers on the Qualcomm device side you also have to update to ensure compatibility? Timings like T[CLK-TERM], T[CLK-SETTLE], T[HS-TERM] and T[HS-SETTLE] will be important.

    Is the decoder error related to ErrFrameSync or ErrFrameData? The target device was only able to receive the CLK, or was it able to receive some data frames as well?

    Thanks & Regards,

    Shiou Mei 

  • Hi Shiou Mei

    I have updated the capture, the CLK and data signals are on the same scope capture.

    Is the decoder error related to ErrFrameSync or ErrFrameData? The target device was only able to receive the CLK, or was it able to receive some data frames as well?

    ->They said that: the decoder error ralated to the ErrFrameSync, but the ErrFrameData is not sure, need to confirm.

    And the target device can receive the clk and the data.

    best wishes

    Chengwu.Tang

  • Chengwu,

    Thanks for the capture!  Recall that you are using 4 lanes for the signal transmission. Have you checked the other three lanes to confirm they are outputting packet data as well?  

    Please also help confirm the following:

    1. What are all the error interrupts the end sensor has encountered? 

    2. Are configurations matching on the sensor side: data rate, VT, DT, resolution?

    You mentioned the target device can receive CLK and DAT, does that mean it was able to capture data correctly?  If this is the case, this also points away from FS issues. Could issue be due to resolution change since FE is occurring earlier now, and the sensor may not be expecting it until later? 

    Best Regards,

    Shiou Mei

  • Hi Shiou Mei

    Recall that you are using 4 lanes for the signal transmission. Have you checked the other three lanes to confirm they are outputting packet data as well? 

    ->The other 3 lanes are almost the same as lane1.

    According to the above cpature, is it enough to confirm whether there is FrameSyncError exist?

    1. What are all the error interrupts the end sensor has encountered? 

    ->The RX side don't know this info.

    2. Are configurations matching on the sensor side: data rate, VT, DT, resolution?

    ->Data Rate & VT : no config interface for it.

    DT : 0x1E

    resolution : 1920x720

    Best Wishes

    Chengwu.Tang

  • Chengwu,

    The 32 bits short packet is interleaved on 4 lanes, so on each one you will only see 8 bits. The waveform signal looks expected. Do you see a value of 0x1 on the DAT2 lane? The FrameSyncError customer observed may be related to SoT timing or FrameEnd, thus why I suspected there may be some configuration mismatches on the sensor side, especially since your setup worked for 1920x1080 but not 1920x720. On DPHY Rx module, there should be error registers to further pinpoint what type of errors occurred, please sanity check these statuses.

    Another good debug step is to update configurations back for 1920x1080 (with lane speed update), confirm setup still works, then reduce the height to 720.

    Best Regards,

    Shiou Mei