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.

RTOS/TDA2PXEVM: ISP Stall Problem

Part Number: TDA2PXEVM

Tool/software: TI-RTOS

Currently we observe an issue where ISSCapture is not sending the images to other links.

 

The issue is occurring in ISSCapture because, IssCaptureLink_drvPutEmptyBuffers is not called after sometime due to which ISS is not sending SYSTEM_CMD_NEW_DATA next links. Basically images from camera is not passed further because Fvid2_deque fails with status -7 in IssCaptureLink_drvProcessData.

 

Further analysis from SV reveals that, ISP link is stalled hence we observe the issue.

We can confirm ISP stall using semaphore with timeout. Refer below code highlighted in Yellow.

 

We see the print “ISP Stall” when the issue is observed

 

links_fw\src\rtos\links_ipu\iss_m2misp\issM2mIspLink_drv_process_frame.c

Function: Int32 IssM2mIspLink_drvProcessFrame

Vision SDK: 3.03

// Check for ISP Stall
#if 0

    BspOsal_semWait(pObj->semProcessCall, BSP_OSAL_WAIT_FOREVER);

#else

    {

        Bool ret;

        ret = BspOsal_semWait(pObj->semProcessCall, 1000);

        if (!ret)

        {

            //to see load and bandwidth

            ChainsCommon_PrintStatistics();

            {

                static int loop = 1;

                Vps_printf("ISP stalled\n");

                while (loop)

                {

                    BspOsal_sleep(200);

                }

            }

        }

        UTILS_assert(ret);

    }

#endif

  • Can you please describe your setup?
    1. Which image sensor and board are you using
    2. What is the version of Vision SDK?
    3. What are the usecase and ISS settings?
    4. Have you made any modifications to Vision SDK?
  • Also there are some fixes in the last Vision SDK release, can you try the last vision sdk release?

    Rgds,
    Brijesh
  • 1. Sensor: AR0220

    2. Vision SDK: 3.03

    3. Below is the ISS settings, its a sample use-case

    4. No modifications

    #include "chains_test_camera_display_priv.h"
    #include <src/include/chains_common.h>
    #include <src/rtos/iss/include/app_util_iss.h>
    #include <src/rtos/iss/include/iss_sensors.h>
    #include <src/rtos/iss/include/iss_utils.h>
    
    /*
     * AEWB algorithm memory requirement cannot be calculated upfront.
     * This size is known by running the use-case once with large size
     * and then checking the log for unused memory in AEWB algorithm
     */
    #define ALG_AEWB_MEM_SIZE (896 * 1024)
    
    typedef struct
    {
        chains_test_camera_displayObj ucObj;
        UInt32 captureOutWidth;
        UInt32 captureOutHeight;
        UInt32 displayWidth;
        UInt32 displayHeight;
        Chains_Ctrl *chainsCfg;
        AppUtils_Obj appSensInfo;
    } chains_test_camera_displayAppObj;
    
    char gchains_test_camera_display_runTimeMenu[] = {
        "\r\n "
        "\r\n ===================="
        "\r\n chains Run-time Menu"
        "\r\n ===================="
        "\r\n "
        "\r\n 0: Stop Chain"
        "\r\n p: Print Performance Statistics "
        "\r\n "
        "\r\n Enter Choice: "
        "\r\n "};
    
    /*
     * This function shows an example of allocating memory for
     * a link from within the use-case instead of from within the link
     *
     * This allows user's to potentially allocate memory statically outside of
     * link implementation and then pass the memory to the link during use-case
     * create.
     *
     * If user wants the link to allocate memory then dont set below parameters
     * <link create params>.memAllocInfo.memSize,
     * <link create params>.memAllocInfo.memAddr
     */
    Void chains_test_camera_display_SetMemAllocInfo(
            chains_test_camera_displayAppObj *pObj)
    {
        UInt32 align = SYSTEM_BUFFER_ALIGNMENT; /* 32 byte alignment*/
        IssCaptureLink_CreateParams *pIssCapturePrm;
        IssM2mIspLink_CreateParams *pIssM2mIspPrm;
        AlgorithmLink_IssAewbCreateParams *pAlg_IssAewbPrm;
    
        pIssCapturePrm = &pObj->ucObj.IssCapturePrm;
        pIssM2mIspPrm = &pObj->ucObj.IssM2mIspPrm;
        pAlg_IssAewbPrm = &pObj->ucObj.Alg_IssAewbPrm;
    
        pIssCapturePrm->memAllocInfo.memSize = SystemUtils_align(
                pObj->captureOutWidth, align) * pObj->captureOutHeight * 2 /* 16-bit per pixel */
        * (pIssCapturePrm->outParams[0].numOutBuf + 1)
        /* +1 for RAW data dump */
        ;
    
        pAlg_IssAewbPrm->memAllocInfo.memSize = ALG_AEWB_MEM_SIZE;
    
        pIssM2mIspPrm->memAllocInfo.memSize = 0;
    
        if (pIssM2mIspPrm->channelParams[0].enableOut[ISSM2MISP_LINK_OUTPUTQUE_IMAGE_RSZ_A])
        {
    #ifdef ISS_ENABLE_DEBUG_TAPS
            /* RSZ A output */
            pIssM2mIspPrm->memAllocInfo.memSize +=
            SystemUtils_align(pIssM2mIspPrm->channelParams[0].outParams.widthRszA, align)
            * pIssM2mIspPrm->channelParams[0].outParams.heightRszA
            * 2 /* YUV420/422/RAW */
            * pIssM2mIspPrm->channelParams[0].numBuffersPerCh
            ;
    #else
            /* RSZ A output */
            pIssM2mIspPrm->memAllocInfo.memSize += SystemUtils_align(
                    pIssM2mIspPrm->channelParams[0].outParams.widthRszA, align)
                    * pIssM2mIspPrm->channelParams[0].outParams.heightRszA * 1.5 /* YUV420SP */
                    * pIssM2mIspPrm->channelParams[0].numBuffersPerCh;
    #endif
        }
    
        if (pIssM2mIspPrm->channelParams[0].operatingMode
                == ISSM2MISP_LINK_OPMODE_2PASS_WDR)
        {
            /* Intermediate buffer in 2 pass WDR mode */
            pIssM2mIspPrm->memAllocInfo.memSize += SystemUtils_align(
                    pObj->captureOutWidth, align) * pObj->captureOutHeight * 2 /* 16-bit per pixel */
            ;
        }
    
        if (pIssM2mIspPrm->channelParams[0].operatingMode
                == ISSM2MISP_LINK_OPMODE_2PASS_WDR_LINE_INTERLEAVED)
        {
            /* Intermediate buffer in 2 pass WDR mode */
            pIssM2mIspPrm->memAllocInfo.memSize += SystemUtils_align(
                    pIssM2mIspPrm->channelParams[0].wdrOffsetPrms.width, align)
                    * pIssM2mIspPrm->channelParams[0].wdrOffsetPrms.height * 2 /* 16-bit per pixel */
                    ;
        }
    
        if (pIssM2mIspPrm->allocBufferForDump)
        {
            /* For Dumping Output frame */
            pIssM2mIspPrm->memAllocInfo.memSize += SystemUtils_align(
                    pObj->captureOutWidth, align) * pObj->captureOutHeight * 2 /* 16-bit per pixel */
            ;
        }
    
        if (pIssM2mIspPrm->channelParams[0].enableOut[ISSM2MISP_LINK_OUTPUTQUE_IMAGE_RSZ_B])
        {
            /* RSZ B output */
            pIssM2mIspPrm->memAllocInfo.memSize += SystemUtils_align(
                    pIssM2mIspPrm->channelParams[0].outParams.widthRszB, align)
                    * pIssM2mIspPrm->channelParams[0].outParams.heightRszB * 1.5 /* YUV420SP */
                    * pIssM2mIspPrm->channelParams[0].numBuffersPerCh;
        }
    
        if (pIssM2mIspPrm->channelParams[0].enableOut[ISSM2MISP_LINK_OUTPUTQUE_H3A])
        {
            /* H3A output */
            pIssM2mIspPrm->memAllocInfo.memSize +=
                    ((pIssM2mIspPrm->channelParams[0].outParams.widthRszA
                            / pIssM2mIspPrm->channelParams[0].outParams.winWidthH3a)
                            + 1)
                            * ((pIssM2mIspPrm->channelParams[0].outParams.heightRszA
                                    / pIssM2mIspPrm->channelParams[0].outParams.winHeightH3a)
                                    + 1)
                            * (sizeof(IssAwebH3aOutSumModeOverlay)
                                    + sizeof(IssAwebH3aOutUnsatBlkCntOverlay))
                            * pIssM2mIspPrm->channelParams[0].numBuffersPerCh;
        }
    
        /* To support WDR, two sets of statistics must be produced, one for short exposure and the other one for long exposure
         that's why there is a factor 2
         */
        if (pIssM2mIspPrm->channelParams[0].enableOut[ISSM2MISP_LINK_OUTPUTQUE_H3A_AF])
        {
            pIssM2mIspPrm->memAllocInfo.memSize += SystemUtils_align(
                    2 * pIssM2mIspPrm->channelParams[0].outParams.paxelNumHaf
                            * pIssM2mIspPrm->channelParams[0].outParams.paxelNumVaf
                            * sizeof(IssAfH3aOutOverlay),
                    128U) /* DSP cache requires 128 bytes alignment */
            * pIssM2mIspPrm->channelParams[0].numBuffersPerCh;
        }
    
        pIssCapturePrm->memAllocInfo.memAddr = (UInt32) Utils_memAlloc(
                UTILS_HEAPID_DDR_CACHED_SR, pIssCapturePrm->memAllocInfo.memSize,
                align);
        UTILS_assert(pIssCapturePrm->memAllocInfo.memAddr!=NULL);
    
        pAlg_IssAewbPrm->memAllocInfo.memAddr = (UInt32) Utils_memAlloc(
                UTILS_HEAPID_DDR_CACHED_SR, pAlg_IssAewbPrm->memAllocInfo.memSize,
                align);
        UTILS_assert(pAlg_IssAewbPrm->memAllocInfo.memAddr!=NULL);
    
        pIssM2mIspPrm->memAllocInfo.memAddr = (UInt32) Utils_memAlloc(
                UTILS_HEAPID_DDR_CACHED_SR, pIssM2mIspPrm->memAllocInfo.memSize,
                align);
        UTILS_assert(pIssM2mIspPrm->memAllocInfo.memAddr!=NULL);
    
    }
    
    Void chains_test_camera_display_FreeMemory(chains_test_camera_displayAppObj *pObj)
    {
        Int32 status;
        IssCaptureLink_CreateParams *pIssCapturePrm;
        IssM2mIspLink_CreateParams *pIssM2mIspPrm;
        AlgorithmLink_IssAewbCreateParams *pAlg_IssAewbPrm;
    
        pIssCapturePrm = &pObj->ucObj.IssCapturePrm;
        pIssM2mIspPrm = &pObj->ucObj.IssM2mIspPrm;
        pAlg_IssAewbPrm = &pObj->ucObj.Alg_IssAewbPrm;
    
        if (pIssCapturePrm->memAllocInfo.memAddr)
        {
            status = Utils_memFree(UTILS_HEAPID_DDR_CACHED_SR,
                                   (Ptr) pIssCapturePrm->memAllocInfo.memAddr,
                                   pIssCapturePrm->memAllocInfo.memSize);
            UTILS_assert(status == 0);
        }
    
        if (pAlg_IssAewbPrm->memAllocInfo.memAddr)
        {
            status = Utils_memFree(UTILS_HEAPID_DDR_CACHED_SR,
                                   (Ptr) pAlg_IssAewbPrm->memAllocInfo.memAddr,
                                   pAlg_IssAewbPrm->memAllocInfo.memSize);
            UTILS_assert(status == 0);
        }
    
        if (pIssM2mIspPrm->memAllocInfo.memAddr)
        {
            status = Utils_memFree(UTILS_HEAPID_DDR_CACHED_SR,
                                   (Ptr) pIssM2mIspPrm->memAllocInfo.memAddr,
                                   pIssM2mIspPrm->memAllocInfo.memSize);
            UTILS_assert(status == 0);
        }
    }
    
    Void chains_test_camera_display_SetDisplayPrms(DisplayLink_CreateParams *pPrm_Video,
                                           Chains_DisplayType displayType,
                                           UInt32 displayWidth,
                                           UInt32 displayHeight,
                                           UInt32 captureWidth,
                                           UInt32 captureHeight)
    {
        UInt32 dispWidth, dispHeight;
    
        if (pPrm_Video)
        {
            if ((displayType == CHAINS_DISPLAY_TYPE_SDTV_NTSC)
                    || (displayType == CHAINS_DISPLAY_TYPE_SDTV_PAL))
            {
                pPrm_Video->displayScanFormat = SYSTEM_SF_INTERLACED;
            }
    
            /* To maintain the aspect ratio, change the display tarWidth */
            dispWidth = captureWidth * displayHeight / captureHeight;
            dispHeight = displayHeight;
    
            if (dispWidth > displayWidth)
            {
                dispWidth = displayWidth;
                dispHeight = displayWidth * captureHeight / captureWidth;
            }
    
            pPrm_Video->rtParams.tarWidth = dispWidth;
            pPrm_Video->rtParams.tarHeight = dispHeight;
            pPrm_Video->rtParams.posX = (displayWidth - dispWidth) / 2U;
            pPrm_Video->rtParams.posY = (displayHeight - dispHeight) / 2U;
    
            pPrm_Video->displayId = DISPLAY_LINK_INST_DSS_VID1;
        }
    }
    
    Void chains_test_camera_display_SetIspConfig(chains_test_camera_displayAppObj *pObj)
    {
        appSetDefaultIspParams(&pObj->appSensInfo);
        appSetIspParamsFromDCC(&pObj->appSensInfo);
    }
    
    Void chains_test_camera_display_setMuxes(
            chains_test_camera_displayAppObj *pObj)
    {
        /* Setup PinMux */
        ChainsPlatform_SetPinMux(pObj->chainsCfg->sensorName);
    
        /* Init Board Mux */
        ChainsBoard_SetBoardMux(pObj->chainsCfg->sensorName);
    }
    
    Void chains_test_camera_display_SetAppPrms(chains_test_camera_displayObj *pUcObj,
                                       Void *appObj)
    {
        chains_test_camera_displayAppObj *pObj = (chains_test_camera_displayAppObj *)appObj;
    
        ChainsCommon_GetDisplayWidthHeight(pObj->chainsCfg->displayType,
                                           &pObj->displayWidth, &pObj->displayHeight);
    
        /* Create the sensor now */
        strncpy(pObj->appSensInfo.sensorName, pObj->chainsCfg->sensorName,
                ISS_SENSORS_MAX_NAME);
        pObj->appSensInfo.numCh = 1;
        pObj->appSensInfo.ispOpMode = pObj->chainsCfg->ispOpMode;
        pObj->appSensInfo.numCSI2Inst = 1;
        appCreateISSSensor(&pObj->appSensInfo);
    
        appInitIssCaptParams(&pObj->appSensInfo, pUcObj->IssCaptureLinkID,
                             &pUcObj->IssCapturePrm);
        appInitIssIspParams(&pObj->appSensInfo, pUcObj->IssM2mIspLinkID,
                            &pUcObj->IssM2mIspPrm);
        appInitIssAewbParams(&pObj->appSensInfo, pUcObj->Alg_IssAewbLinkID,
                             &pUcObj->Alg_IssAewbPrm);
    
        pUcObj->IssM2mIspPrm.allocBufferForDump = TRUE;
        pUcObj->IssCapturePrm.allocBufferForRawDump = TRUE;
    
        pObj->captureOutWidth = pUcObj->IssCapturePrm.outParams[0U].width;
        pObj->captureOutHeight = pUcObj->IssCapturePrm.outParams[0U].height;
    
        /*
       * call this function to allocate memory from use-case
       * if this function is not called memory is allocated
       * from within the respective link
       */
        // chains_test_camera_display_SetMemAllocInfo(pObj);
    
        chains_test_camera_display_SetDisplayPrms(
                &pUcObj->Display_VideoPrm,
                pObj->chainsCfg->displayType,
                pObj->displayWidth, pObj->displayHeight,
                pUcObj->IssM2mIspPrm.channelParams[0U].outParams.widthRszA,
                pUcObj->IssM2mIspPrm.channelParams[0U].outParams.heightRszA);
    
        ChainsCommon_StartDisplayCtrl(pObj->chainsCfg->displayType,
                                      pObj->displayWidth, pObj->displayHeight);
    }
    
    Void chains_test_camera_display_StartApp(chains_test_camera_displayAppObj *pObj)
    {
        Chains_memPrintHeapStatus();
        chains_test_camera_display_SetIspConfig(pObj);
        chains_test_camera_display_setMuxes(pObj);
        appStartIssSensorSerDes(&pObj->appSensInfo);
        ChainsCommon_StartDisplayDevice(pObj->chainsCfg->displayType);
        chains_test_camera_display_Start(&pObj->ucObj);
        Chains_prfLoadCalcEnable(TRUE, FALSE, FALSE);
    }
    
    Void chains_test_camera_display_StopAndDeleteApp(chains_test_camera_displayAppObj *pObj)
    {
        chains_test_camera_display_Stop(&pObj->ucObj);
        chains_test_camera_display_Delete(&pObj->ucObj);
    
        chains_test_camera_display_FreeMemory(pObj);
    
        ChainsCommon_StopDisplayCtrl();
    
        appStopISSSensor(&pObj->appSensInfo);
    
        appDeleteISSSensor(&pObj->appSensInfo);
    
        ChainsCommon_StopDisplayDevice(pObj->chainsCfg->displayType);
    
        /* Print the HWI, SWI and all tasks load */
        /* Reset the accumulated timer ticks */
        Chains_prfLoadCalcEnable(FALSE, TRUE, TRUE);
    }
    
    Void Chains_test_camera_display(Chains_Ctrl *chainsCfg)
    {
        char ch;
        UInt32 done = FALSE;
        chains_test_camera_displayAppObj chainsObj;
    
        UTILS_assert(chainsCfg != NULL);
        strncpy(chainsCfg->sensorName, SENSOR_AR0220, ISS_SENSORS_MAX_NAME);
    
        if (TRUE == IssM2mIspLink_IsWdrMode(chainsCfg->ispOpMode))
        {
            Vps_printf(" chains: Please make sure BSP is build with WDR and LDC "
                       "enabled !!!\n");
        }
    
        chainsObj.chainsCfg = chainsCfg;
    
        /* Initialize Video Sensor, so that Algorithm can use Params
       from Vid Sensor layer */
        chains_test_camera_display_Create(&chainsObj.ucObj, &chainsObj);
        ChainsCommon_SetIssCaptureErrorHandlingCb(chainsObj.ucObj.IssCaptureLinkID);
        chains_test_camera_display_StartApp(&chainsObj);
    
        while (!done)
        {
            Vps_printf(gchains_test_camera_display_runTimeMenu);
    
            ch = Chains_readChar();
    
            switch (ch)
            {
            case '0':
                done = TRUE;
                break;
            case 'p':
            case 'P':
                ChainsCommon_PrintStatistics();
                chains_test_camera_display_printStatistics(&chainsObj.ucObj);
                break;
            default:
                Vps_printf("\nUnsupported option '%c'. Please try again\n", ch);
                break;
            }
        }
    
        chains_test_camera_display_StopAndDeleteApp(&chainsObj);
    }

  • Can you try commenting out call to chains_test_camera_display_SetMemAllocInfo?

    Rgds,

    Brijesh

  • After taking ISP/ISS changes from VSDK 3.06, the camera is working fine.

    Thanks,

    Vijeet