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.

EDMA3 is not working properly with codec engine2.10.02

Hello I am using DM6467  and codec engine version 2.10.02.

My application is video analytics.

In the code, I am running the video analytics algorithm and copy the input frame buff into output frame buff with memcpy function. The code is work fine.

When I use EDMA3 to copy input frame buff into output frame buff instead of memcpy function then code is not working. It is stuck in between. But if I use only the EDAM3  to copy input frame into output frame without running algorithm (only loopback with EDAM3) then its work fine.

some times its work for some n number of frames and then stuck( some times work up to 300, 400 number of frames).

memcpy (that works) and the EDMA3 copy inside the video analytics algorithm and all in the DSP side.

I am using IDMA3.

I am using framework provided library (e.g. ACPY3 start, configure and wait etc..)

I dont know why this happen.

Can anyone help me? What is the problem and how to debug the code.

Regards,

Naresh

  • This link has some information on common issues leading to hangs, when using ACPY3.

     

    http://processors.wiki.ti.com/index.php/Framework_Components_FAQ#ACPY3_Questions

  • Thank you for your prompt response gunjan,

    I m copying DDR to DDR. both the buffers in external memory. i am not hanging on ACPY3_wait function.

    The process hangs immediately after a single transfer is apparently completed (we don’t get a chance to see if it got transferred correctly or not). We have put breakpoints in the code using CCS and a JTAG emulator.  We have two such transfers lined up sequentially. The code hits the breakpoints before the ACPY3 params are configured and after the  transfer is completed for the 1st one but doesn’t even hit the breakpoint to begin the next transfer.

    here is my configuration

    var DMAN3 = xdc.useModule('ti.sdo.fc.dman3.DMAN3');


    DMAN3.heapInternal = "IRAM";

    DMAN3.heapExternal = "DDRALGHEAP";

    DMAN3.idma3Internal = false;

    DMAN3.scratchAllocFxn = "DSKT2_allocScratch";

    DMAN3.scratchFreeFxn = "DSKT2_freeScratch";

    // DMAN3 will inclusively manage PaRAMs 78-125, QDMA channels 0-7, tcc's 32-63

    DMAN3.paRamBaseIndex = 80;

    DMAN3.numPaRamEntries = 48;

    DMAN3.numQdmaChannels = 8;

    DMAN3.qdmaChannels = [0,1,2,3,4,5,6,7];

    DMAN3.tccAllocationMaskL = 0;

    DMAN3.tccAllocationMaskH = 0xffffffff;

    // DMAN3.trace = true; // false; //true;

    DMAN3.trace = false;

     /*

    * ======== DSKT2 and RMAN Configuration ========

    * XDAIS Algorithm Memory and DMA allocation

    */

    var DSKT2 = xdc.useModule('ti.sdo.fc.dskt2.DSKT2');

    DSKT2.DARAM0 = "IRAM";

    DSKT2.DARAM1 = "IRAM";

    DSKT2.DARAM2 = "IRAM";

    DSKT2.SARAM0 = "IRAM";

    DSKT2.SARAM1 = "IRAM";

    DSKT2.SARAM2 = "IRAM";

    DSKT2.ESDATA = "DDRALGHEAP";

    DSKT2.IPROG = "IRAM";

    DSKT2.EPROG = "DDR2";

    DSKT2.DSKT2_HEAP = "DDR2"; /* to allocate internal DSKT2 object */

    DSKT2.trace = false;

    DSKT2.debug = false;

     

    DSKT2.DARAM_SCRATCH_SIZES = [ 32768, 16384, 0,0,0,0,0, /* ... */ 0 ];

    DSKT2.SARAM_SCRATCH_SIZES = [ 32768, 16384, 0,0,0,0,0, /* ... */ 0 ];

    // DSKT2.DARAM_SCRATCH_SIZES = [ 65536, 16384, 0,0,0,0,0, /* ... */ 0 ];

    // DSKT2.SARAM_SCRATCH_SIZES = [ 65536, 16384, 0,0,0,0,0, /* ... */ 0 ];

     

    var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');

    RMAN.useDSKT2 = true;

    RMAN.tableSize = 10;

    RMAN.semCreateFxn = "Sem_create";

    RMAN.semDeleteFxn = "Sem_delete";

    RMAN.semPendFxn = "Sem_pend";

    RMAN.semPostFxn = "Sem_post";

    RMAN.debug = false;

    RMAN.trace = false;

     

    var EDMA3 = xdc.useModule('ti.sdo.fc.edma3.Settings');

    EDMA3.maxPaRams[0] = 384;

    EDMA3.maxTccs[0] = 24; // 49;

    EDMA3.maxEdmaChannels[0] = 24; // 49;

    EDMA3.maxQdmaChannels[0] = 0;

    EDMA3.trace = false; //true;

    EDMA3.debug = false; //true;

    var EDMA3CHAN = xdc.useModule('ti.sdo.fc.ires.edma3chan.EDMA3CHAN');

    EDMA3CHAN.debug = false;

    EDMA3CHAN.trace = false;


    // handle configuration
        dmaTab[i].handle = fcpy->dmaHandle2D[i];
        dmaTab[i].numTransfers = 1;
        dmaTab[i].numWaits = 1;
        dmaTab[i].priority = IDMA3_PRIORITY_LOW; //IDMA3_PRIORITY_HIGH;
        dmaTab[i].protocol = &ACPY3_PROTOCOL;
        dmaTab[i].persistent = FALSE; //TRUE
     

  • Hello Gunjan,

    I am eagerly waiting for your response on this issue.

    It is highly appreciated if you could revert back ASAP.

    Regards,

    Naresh

     

     

     

  • Hi Naresh,

    Inside your algorithm can you check the and see if the 'env' field of the IDMA3_Handle that you are passing to the ACPY3 functions is an internal memory address?
    The 'env' should be allocated in internal memory, and you could get stuck if it has been allocated in external memory due to some configuration issue or running out of internal heap.

    Best regards,

    Murat

     

  • Thank you Murat for your response.

    I am new to this DSP DM6467. Can you please guide me how to check t 'env' field of the IDMA3_handle is in internal memory and how to configure it.

    here is the .cfg file content of combo module.

     

     

    Regards,

    Naresh

    var DMAN3 = xdc.useModule('ti.sdo.fc.dman3.DMAN3');

    DMAN3.heapInternal = "IRAM";

    DMAN3.heapExternal = "DDRALGHEAP";

    DMAN3.idma3Internal = false;

    DMAN3.scratchAllocFxn = "DSKT2_allocScratch";

    DMAN3.scratchFreeFxn = "DSKT2_freeScratch";

    // DMAN3 will inclusively manage PaRAMs 78-125, QDMA channels 0-7, tcc's 32-63

    DMAN3.paRamBaseIndex = 80;

    DMAN3.numPaRamEntries = 48;

    DMAN3.numQdmaChannels = 8;

    DMAN3.qdmaChannels = [0,1,2,3,4,5,6,7];

    DMAN3.tccAllocationMaskL = 0;

    DMAN3.tccAllocationMaskH = 0xffffffff;

    // DMAN3.trace = true; // false; //true;

    DMAN3.trace = false;

     

     

    /*

    * ======== DSKT2 and RMAN Configuration ========

    * XDAIS Algorithm Memory and DMA allocation

    */

    var DSKT2 = xdc.useModule('ti.sdo.fc.dskt2.DSKT2');

    DSKT2.DARAM0 = "IRAM";

    DSKT2.DARAM1 = "IRAM";

    DSKT2.DARAM2 = "IRAM";

    DSKT2.SARAM0 = "IRAM";

    DSKT2.SARAM1 = "IRAM";

    DSKT2.SARAM2 = "IRAM";

    DSKT2.ESDATA = "DDRALGHEAP";

    DSKT2.IPROG = "IRAM";

    DSKT2.EPROG = "DDR2";

    DSKT2.DSKT2_HEAP = "DDR2"; /* to allocate internal DSKT2 object */

    DSKT2.trace = false;

    DSKT2.debug = false;

     

    DSKT2.DARAM_SCRATCH_SIZES = [ 32768, 16384, 0,0,0,0,0, /* ... */ 0 ];

    DSKT2.SARAM_SCRATCH_SIZES = [ 32768, 16384, 0,0,0,0,0, /* ... */ 0 ];

    // DSKT2.DARAM_SCRATCH_SIZES = [ 65536, 16384, 0,0,0,0,0, /* ... */ 0 ];

    // DSKT2.SARAM_SCRATCH_SIZES = [ 65536, 16384, 0,0,0,0,0, /* ... */ 0 ];

     

    var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');

    RMAN.useDSKT2 = true;

    RMAN.tableSize = 10;

    RMAN.semCreateFxn = "Sem_create";

    RMAN.semDeleteFxn = "Sem_delete";

    RMAN.semPendFxn = "Sem_pend";

    RMAN.semPostFxn = "Sem_post";

    RMAN.debug = false;

    RMAN.trace = false;

     

    var EDMA3 = xdc.useModule('ti.sdo.fc.edma3.Settings');

    EDMA3.maxPaRams[0] = 384;

    EDMA3.maxTccs[0] = 24; // 49;

    EDMA3.maxEdmaChannels[0] = 24; // 49;

    EDMA3.maxQdmaChannels[0] = 0;

    EDMA3.trace = false; //true;

    EDMA3.debug = false; //true;

    var EDMA3CHAN = xdc.useModule

  • Via a breakpoint in your algorithm, at the point where you call ACPY3_configure (or any other ACPY3 function) look at the fields of the IDMA3_Handle you are passing to the ACPY3 function. The 'env' field is a pointer containing the address of the memory allocated for the handle's env structure, this address must be an internal memory address. So, you should check and make sure this is the case.

    Regards, Murat

    Naresh850 said:

    Thank you Murat for your response.

    I am new to this DSP DM6467. Can you please guide me how to check t 'env' field of the IDMA3_handle is in internal memory and how to configure it.

    here is the .cfg file content of combo module.

     

     

    Regards,

    Naresh

     

    var DMAN3 = xdc.useModule('ti.sdo.fc.dman3.DMAN3');

    DMAN3.heapInternal = "IRAM";

    DMAN3.heapExternal = "DDRALGHEAP";

    DMAN3.idma3Internal = false;

    DMAN3.scratchAllocFxn = "DSKT2_allocScratch";

    DMAN3.scratchFreeFxn = "DSKT2_freeScratch";

    // DMAN3 will inclusively manage PaRAMs 78-125, QDMA channels 0-7, tcc's 32-63

    DMAN3.paRamBaseIndex = 80;

    DMAN3.numPaRamEntries = 48;

    DMAN3.numQdmaChannels = 8;

    DMAN3.qdmaChannels = [0,1,2,3,4,5,6,7];

    DMAN3.tccAllocationMaskL = 0;

    DMAN3.tccAllocationMaskH = 0xffffffff;

    // DMAN3.trace = true; // false; //true;

    DMAN3.trace = false;

     

     

    /*

    * ======== DSKT2 and RMAN Configuration ========

    * XDAIS Algorithm Memory and DMA allocation

    */

    var DSKT2 = xdc.useModule('ti.sdo.fc.dskt2.DSKT2');

    DSKT2.DARAM0 = "IRAM";

    DSKT2.DARAM1 = "IRAM";

    DSKT2.DARAM2 = "IRAM";

    DSKT2.SARAM0 = "IRAM";

    DSKT2.SARAM1 = "IRAM";

    DSKT2.SARAM2 = "IRAM";

    DSKT2.ESDATA = "DDRALGHEAP";

    DSKT2.IPROG = "IRAM";

    DSKT2.EPROG = "DDR2";

    DSKT2.DSKT2_HEAP = "DDR2"; /* to allocate internal DSKT2 object */

    DSKT2.trace = false;

    DSKT2.debug = false;

     

    DSKT2.DARAM_SCRATCH_SIZES = [ 32768, 16384, 0,0,0,0,0, /* ... */ 0 ];

    DSKT2.SARAM_SCRATCH_SIZES = [ 32768, 16384, 0,0,0,0,0, /* ... */ 0 ];

    // DSKT2.DARAM_SCRATCH_SIZES = [ 65536, 16384, 0,0,0,0,0, /* ... */ 0 ];

    // DSKT2.SARAM_SCRATCH_SIZES = [ 65536, 16384, 0,0,0,0,0, /* ... */ 0 ];

     

    var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');

    RMAN.useDSKT2 = true;

    RMAN.tableSize = 10;

    RMAN.semCreateFxn = "Sem_create";

    RMAN.semDeleteFxn = "Sem_delete";

    RMAN.semPendFxn = "Sem_pend";

    RMAN.semPostFxn = "Sem_post";

    RMAN.debug = false;

    RMAN.trace = false;

     

    var EDMA3 = xdc.useModule('ti.sdo.fc.edma3.Settings');

    EDMA3.maxPaRams[0] = 384;

    EDMA3.maxTccs[0] = 24; // 49;

    EDMA3.maxEdmaChannels[0] = 24; // 49;

    EDMA3.maxQdmaChannels[0] = 0;

    EDMA3.trace = false; //true;

    EDMA3.debug = false; //true;

    var EDMA3CHAN = xdc.useModule

  • Thanks Marut for your early response.

    I test the code as per your guidance and check the memory address of 'env' field .

    Please look the below code. THere I mentioned the location of break point.


    Void VCA_ALGORITHMS_MT_doCopy2D2D(IDMA3_Handle dmaHandle, Void *in, Void *out, ElemStruct *elem)
    { // first break point
     
        ACPY3_Params params;
        /*
         * Activate Channel  scratch DMA channels.
         */
        ACPY3_activate(dmaHandle);
     
     /* Configure the logical channel */
        params.transferType = ACPY3_2D2D;

     params.srcAddr = (void *)in;
        params.dstAddr = (void *)out;

        params.elementSize =(elem->LineLength);
        params.numElements =(elem->NumLines);
        params.numFrames = 1;

        params.srcElementIndex = elem->srcLineOffset;
        params.dstElementIndex = elem->dstLineOffset;

     params.srcFrameIndex = 0;
        params.dstFrameIndex = 0; 

        params.waitId = 0;

      /* Configure logical dma channel */
        ACPY3_configure(dmaHandle, &params, 0);
       
        /* Use DMA to fcpy input buffer into working buffer */
        ACPY3_start(dmaHandle);

        /* Check that dma transfer has completed before finishing "processing" */

    //secound break point
        while (!ACPY3_complete(dmaHandle)) {
            ;
        };

        /*
         * DeActivate Channel  scratch DMA channels.
         */
        ACPY3_deactivate(dmaHandle);

    }// third break point


    Memory address of 'env' field

    at Break point 1
    memory address of env: 0x8c131cc0 (external memory)
    memory address of dmahandle[0]->env: can't load from non primitive location


    at Break point 2
    memory address of env: 0x118118020 (internal memory)
    memory address of dmahandle[0]->env: can not load from non primitive location


    at Break point 3
    memory address of env: ox8c131cc0 (external memory)
    memory address of dmahandle[0]->env: can not load from non primitive location

    Now how can i decided the actual memory addres of env field? IS it internal or external?

    Can you please guide me in this regard?

    thanks
    Naresh

  • Naresh850 said:

    Thanks Marut for your early response.

    I test the code as per your guidance and check the memory address of 'env' field .

    Hi Naresh,

    Once the channel is activated via ACPY3_activate the 'env' field is assigned an internal memory address, so that doesn't seem to be a problem. I am not sure what the issue is at this point. Are you still stuck with the problem?

    Murat

    Please look the below code. THere I mentioned the location of break point.


    Void VCA_ALGORITHMS_MT_doCopy2D2D(IDMA3_Handle dmaHandle, Void *in, Void *out, ElemStruct *elem)
    { // first break point
     
        ACPY3_Params params;
        /*
         * Activate Channel  scratch DMA channels.
         */
        ACPY3_activate(dmaHandle);
     
     /* Configure the logical channel */
        params.transferType = ACPY3_2D2D;

     params.srcAddr = (void *)in;
        params.dstAddr = (void *)out;

        params.elementSize =(elem->LineLength);
        params.numElements =(elem->NumLines);
        params.numFrames = 1;

        params.srcElementIndex = elem->srcLineOffset;
        params.dstElementIndex = elem->dstLineOffset;

     params.srcFrameIndex = 0;
        params.dstFrameIndex = 0; 

        params.waitId = 0;

      /* Configure logical dma channel */
        ACPY3_configure(dmaHandle, &params, 0);
       
        /* Use DMA to fcpy input buffer into working buffer */
        ACPY3_start(dmaHandle);

        /* Check that dma transfer has completed before finishing "processing" */

    //secound break point
        while (!ACPY3_complete(dmaHandle)) {
            ;
        };

        /*
         * DeActivate Channel  scratch DMA channels.
         */
        ACPY3_deactivate(dmaHandle);

    }// third break point


    Memory address of 'env' field

    at Break point 1
    memory address of env: 0x8c131cc0 (external memory)
    memory address of dmahandle[0]->env: can't load from non primitive location


    at Break point 2
    memory address of env: 0x118118020 (internal memory)
    memory address of dmahandle[0]->env: can not load from non primitive location


    at Break point 3
    memory address of env: ox8c131cc0 (external memory)
    memory address of dmahandle[0]->env: can not load from non primitive location

    Now how can i decided the actual memory addres of env field? IS it internal or external?

    Can you please guide me in this regard?

    thanks
    Naresh

  • Hi MArut,

    Yes, I am still stuck with the problem.

    Please do needful ASAP

    regards,

    NAresh 

     

  • Can you please show exactly which lines of code get stuck?  Perhaps copy/paste your code and highlight put a comment somewhere like "never gets here".  I apologize if you already gave that info.  I've been hunting through your code but couldn't find it.  Does it always get stuck at the same place?  Just so I understand correctly, you never hit your breakpoint at all correct, as opposed to hitting the breakpoint but the data not copying correctly?

  • Hi

    Here is the code. I highlited the breakpoint with yellow colour.

    After few frames code get stuck at the same place every time.(number of frame is not consistent ). code get stuck so we can not verify the data, its correct or wrong.

    #define USE_EDMA

    U32 MT_HD (VCA_ALGORITHMS_MT_Obj *obj,XDM1_BufDesc *inBufs, XDM1_BufDesc *outBufs,
         VCA_MT_Ext_InArgs *InArgs,
         VCA_MT_Ext_OutArgs *OutArgs)
    {

     U8 *img;
     U8 *imguv;
     FRAME sOutputframeYUV;
     FRAME sOutputframeUV;
        //ElemStruct elem,elem_uv;  // for edma parameters
    ElemStruct elem,elem_uv;  // for edma parameters
     U8 * restrict pu8ImDiff;
     U32 u32FrameHeight, u32FrameWidth;
     U16 FrameWidth;
     FRAME *psBinaryIpFrame;
     FRAME *psBgrndFrame;
     FRAME * restrict psTempImage;
     U16 *u16RefBgnd;
     U8 *ReTrain;    //Persistent Variable to indicate automatic retraining of HD
     int u32inx;
     int u32x1;
     int u32x2;
     int u32y1;
     int u32y2;
     int j = 0;
     XYCOORDINATES roiCord;

     StructComponentBuffer *componentInfo;
     StructRegionArea *puRegionAreaInfo;
     Strel *puStrel;
     ImageStats *psImSt;
     U32 u32NActPixels = 0;

     U32 u32FrameSize , u32i = 0;//, u32NumFrames = 0;
     ROI sRoi, psROI; /* To hold all ROI */
     int u32numComps, u32CC;
    #ifdef NEW_CC1
     stConnectedComponent *psTempImgComponent = NULL;
    #else /* NEW_CC1 */
     StructImgComponent *psTempImgComponent = NULL;
    #endif /* NEW_CC1 */
     U32 u32j;
     U8 u8Salient  = 0;
     U32 roi_num   = 0; /* roi counter -- Sriraja*/
     U32 u32FGperc = 0;
     U32 u32Drawflg = 0;
     U16 *ps16TempTrain;
     U8 *RoiActivity;

     /* TW strcuture - Pradeep */
     SZ_RoI SZRoI[4];
     U16  i = 0;//, j =0;

     conf_parameters *conf_data1; 
     struct RegOfInterest *HD_Rois;
     struct RegOfInterest *GID_Rois;
     //struct RegOfInterest *TW_Rois;
     ROI_DB *SZ_Rois;
     ROI_DB *SZ_RoisT;
     U8 *image;
     U32       u32k = 0;
    #ifdef NEW_CC1
     stCCUserConfig       sConfig;
     stCCHandle           *psCCHandle; 
     int                  s32Ret = 0;
     stConnectedComponent *psCCOutNode,*psCCTempNode;
     U16                  *pu16ScratchBuff;
     U8                   *buf;
     IplImage1            *inpImg;
    #endif
     U32 u32sizestr   = sizeof(StructComponentBuffer);
     u32sizestr       = sizeof(StructRegionArea);

     //////////////////////////////////////////////////////////////////

     u32FrameHeight   = obj->frameHeight;
     u32FrameWidth    = obj->frameWidth;
     FrameWidth   = obj->frameWidth;
     u32FrameSize     = obj->frameHeight*obj->frameWidth;
     conf_data1       = &conf_data[InArgs->confg_param_index];

     /*************************************************************************/
     /* assigning malloc'ed memory pointers to the frame buffers and structures */
     img            = (U8 *) inBufs->descs[0].buf;
     imguv          = (U8 *) inBufs->descs[1].buf;


     sOutputframeYUV.u8FrameData = (U8 *)outBufs->descs[0].buf;
     sOutputframeUV.u8FrameData  = (U8 *)outBufs->descs[1].buf;//v

     u16RefBgnd                   = (U16 *)( obj->HD_Persistent); //persistent
     psBgrndFrame                 = (FRAME *)( (U8 *)u16RefBgnd + sizeof(U16)*u32FrameSize); //persistent  
     psBgrndFrame->u8FrameData    = (U8 *)((U8 *)psBgrndFrame + sizeof(FRAME));
     psImSt                       = (ImageStats *)( (U8*)(psBgrndFrame->u8FrameData) + u32FrameSize);  //

    #ifdef NEW_CC1

     sConfig.s16ConnectivityType = 8;    //define connectivity 8 or4
        sConfig.s16Foreground       = 1;    // 1 or 0
        sConfig.s32Height           = u32FrameHeight;
        sConfig.s32Width            = u32FrameWidth;
        sConfig.u16BitsPerPixel     = 1;
        sConfig.u16MaxCompAllowed   = 2500;
     
     inpImg      = (IplImage1*)((U8*)psImSt + 24);
     inpImg->imageData = (char*)((U8*)inpImg + 256);
     pu16ScratchBuff = (U16*)((U8*)inpImg->imageData + (u32FrameHeight * u32FrameWidth));

     inpImg->height    = u32FrameHeight;
     inpImg->width     = u32FrameWidth;
     inpImg->widthStep = u32FrameWidth;
     inpImg->imageSize = u32FrameWidth * u32FrameHeight;

     buf = (U8*)pu16ScratchBuff + (u32FrameHeight * (u32FrameWidth<<2) );
     s32Ret =  mt_cc_CreateHandle(&sConfig,&psCCHandle, buf);
        if(s32Ret != ROK)
        {
            DEBUG_PRINT("<- mt_cc_CreateHandle: Connected component handle Failed");
            return s32Ret;
        }
     buf = buf + (120252 + (u32FrameHeight * (u32FrameWidth<<1) ));
     // Initialize output node pointer with Head node
        psCCOutNode = psCCHandle->psCtrlNode->psCCHeadNext[0];

    #endif


    #ifdef REMOVE_BOX
    #ifdef NEW_CC1
     ps16TempTrain = (U16 *)buf;
    #else
     ps16TempTrain = (U16 *)((U8*)puRegionAreaInfo + sizeof(StructRegionArea));
    #endif
    #endif

    #if 1
     /* settings ROIs for HD , GID and SZ */
        HD_Rois   = (struct RegOfInterest *)obj->ROI_Persistent;
        GID_Rois  = (struct RegOfInterest *) ((U8*)(obj->ROI_Persistent) + 400*1);
        SZ_Rois   = (ROI_DB *) ((U8*)(obj->ROI_Persistent) + 400*2);
     RoiActivity = (U8*)GID_Rois+308;
     ReTrain     = (U8 *)GID_Rois+340;
    #endif
      
     
     image       = (U8 *)(obj->scratch);
     psBinaryIpFrame     =  (FRAME *)(image + u32FrameSize);
        psBinaryIpFrame->u8FrameData    = (U8 *)((U8 *)psBinaryIpFrame  + sizeof(FRAME));

       
     pu8ImDiff                    = (U8 *)((U8*)psBinaryIpFrame->u8FrameData  + u32FrameSize );
        memset(pu8ImDiff, 0, u32FrameSize);
       
     psTempImage                  =  (FRAME *)(pu8ImDiff + u32FrameSize);
        psTempImage->u8FrameData     = (U8 *)((U8 *)psTempImage + sizeof(FRAME));

     SCRATCH_2 = (U8*)(psTempImage->u8FrameData ) + u32FrameSize;
     SCRATCH_3 = SCRATCH_2 + (sizeof(U8) * (u32FrameSize +12));
     SCRATCH_6 = (U16*)(SCRATCH_3 + (sizeof(U8*) * u32FrameHeight));
     /*************************************************************************/ 

     /* memory allocated for Sterile zone */
     //image = (U8 *)(obj->scratch);
     puStrel = (Strel *)SCRATCH_3;
     puStrel->u32SizeX    = 4;
     puStrel->u32SizeY    = 9;
     puStrel->u8StrelData = NULL;

     /***********************
     * frame to draw activity
     ************************/
     psBinaryIpFrame->u32FrameHeight = u32FrameHeight;
     psBinaryIpFrame->u32FrameWidth  = u32FrameWidth;
     psTempImage->u32FrameHeight = u32FrameHeight;
     psTempImage->u32FrameWidth  = u32FrameWidth;

     psBgrndFrame->u32FrameHeight = u32FrameHeight;
     psBgrndFrame->u32FrameWidth  = u32FrameWidth;

     // Replaced static variable "u32PrevFrCnt" with persistent structure member
     u32i = InArgs->u32Frameno - psImSt->u32PrevFrCnt;
     psImSt->u32Threshold = u32thresh[InArgs->light_sensitivity_index];
       
     if(1 == InArgs->scene_changed)
     {
      /* Copied from new version */
      memset(psBgrndFrame->u8FrameData, 0, u32FrameSize);
      memset(u16RefBgnd, 0, sizeof(U16)*u32FrameSize);

      HD_FrameMean(psBgrndFrame, psImSt);
     
      if(InArgs->u32Frameno > 0)
      {
       /* Size 48116 is the size of memories for componentInfo and  puRegionAreaInfo buffers */
       memset(componentInfo, 0, 48116);
       psImSt->u32PrevFrCnt = InArgs->u32Frameno;
      }   
      return 0; 
     }


           
       if( (u32i % HD_FRAME_EXEC_RATE) == 0)
       {
          if (HD_Rois->u32NumCordinates == 0)    /* Default case */
           {
          sRoi.Cord[0].u32x1 = 0;
       sRoi.Cord[0].u32y1 = 0;
       sRoi.Cord[0].u32x2 = (u32FrameWidth - 1);
       sRoi.Cord[0].u32y2 = (u32FrameHeight - 1);
       sRoi.u32NumCordinates = 0;
           }
           else
           {
          
       for (roi_num=0;roi_num < HD_Rois->u32NumCordinates;roi_num++) 
       {
        sRoi.Cord[roi_num].u32x1 = HD_Rois->Cord[roi_num].u32x1;
        sRoi.Cord[roi_num].u32x2 = HD_Rois->Cord[roi_num].u32x2;
        sRoi.Cord[roi_num].u32y1 = HD_Rois->Cord[roi_num].u32y1;
        sRoi.Cord[roi_num].u32y2 = HD_Rois->Cord[roi_num].u32y2;
       }
       sRoi.u32NumCordinates = HD_Rois->u32NumCordinates;
           }
       }/* if( (u32i % HD_FRAME_EXEC_RATE) == 0) */

    #ifdef USE_EDMA
        elem.LineLength    = obj->frameWidth;
        elem.NumLines      = obj->frameHeight;
        elem.srcLineOffset = obj->frameWidth;
        elem.dstLineOffset = obj->frameWidth;

        elem_uv.LineLength    = obj->frameWidth;
        elem_uv.NumLines      = obj->frameHeight/2;
        elem_uv.srcLineOffset = obj->frameWidth;
        elem_uv.dstLineOffset = obj->frameWidth;

        VCA_ALGORITHMS_MT_doCopy2D2D(dmaHandle2D[0],(U8 *)inBufs->descs[0].buf,(U8 *) outBufs->descs[0].buf,&elem);
        VCA_ALGORITHMS_MT_doCopy2D2D(dmaHandle2D[0],(U8 *)inBufs->descs[1].buf,(U8 *) outBufs->descs[1].buf,&elem_uv);
    #else
     memcpy(sOutputframeYUV.u8FrameData, img, u32FrameSize);
        memcpy(sOutputframeUV.u8FrameData, imguv, (u32FrameSize)>>1);
    #endif

       if( (u32i % AD_FRAME_EXEC_RATE) == 0)
       {  /* TBD = to include counting of active pixels (u32NActPixels)*/
      u32NActPixels = HD_VOIDDiffUpdate (img, //this is "inargs-buff" //forth breakpoint is oppining brace of this function. Never gets here
       pu8ImDiff,
       psBgrndFrame,
       &sRoi,
       psImSt,
       u16RefBgnd,//Aug removed psRefBgnd
       psTempImage,
       ps16TempTrain,
       conf_data1->thr_re_train,
       u32i //Aug added
       );
       }/* if( (u32i % AD_FRAME_EXEC_RATE) == 0) */

    }// end of function
     

     

    This is the EDMA transfer call.

     

    Void VCA_ALGORITHMS_MT_doCopy2D2D(IDMA3_Handle dmaHandle, Void *in, Void *out, ElemStruct *elem)
    { // first break point
     
        ACPY3_Params params;
        /*
         * Activate Channel  scratch DMA channels.
         */
        ACPY3_activate(dmaHandle);
     
     /* Configure the logical channel */
        params.transferType = ACPY3_2D2D;

     params.srcAddr = (void *)in;
        params.dstAddr = (void *)out;

        params.elementSize =(elem->LineLength);
        params.numElements =(elem->NumLines);
        params.numFrames = 1;

        params.srcElementIndex = elem->srcLineOffset;
        params.dstElementIndex = elem->dstLineOffset;

     params.srcFrameIndex = 0;
        params.dstFrameIndex = 0; 

        params.waitId = 0;

      /* Configure logical dma channel */
        ACPY3_configure(dmaHandle, &params, 0);
       
        /* Use DMA to fcpy input buffer into working buffer */
        ACPY3_start(dmaHandle);

        /* Check that dma transfer has completed before finishing "processing" */

    //secound break point
        while (!ACPY3_complete(dmaHandle)) {
            ;
        };

        /*
         * DeActivate Channel  scratch DMA channels.
         */
        ACPY3_deactivate(dmaHandle);

    }// third break point


    Thanks
    Naresh

     

  • I don't see anything that jumps out with your EDMA code.  Based on the fact that it fails after a random number of frames I suspect something like a stack overflow, etc.  You should go through some of the steps listed here:

    http://processors.wiki.ti.com/index.php?title=DSP_BIOS_Debugging_Tips

  • Hello Brad,

    As per your guidence, I check the stacks in the CCS. but there is no any stack obverflow occured.

    Still stuck with the same problem.

    plz guide me furthere.

    regards,

    Naresh

     

     

     

     

  • The Codec Engine and Framework Components you are using are 2.5 years old.  Please update to the latest version as there have been numerous bug fixes in that time.  Note that dsplink is no longer bundled as part of Codec Engine so you'll need download that too.  The latest versions can be downloaded here.