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.

DM648 unexplained behavior while using the Video Preview demo

Dear friends,

We are using DM648 for quite some time in several products.

So far, our software was “based” (with many modifications) on the dm648_demo_0_92_04 application supplied with the dvsdk_1_11_00_00_DM648 package.

In order to simplify our software, we would like to base it on the Video Preview example.

The video_preview task in this example includes the following infinite loop:

 

while (status == 0) {

 

       /* grab a fresh video input frame */

       FVID_exchange(capChan, &frameBuffPtr);

                                                                          

       /* display the video frame */

       FVID_exchange(disChan, &frameBuffPtr);   

 

}

 

When we do our processing  between the 2 FVID_exchange calls, everything works fine.

In addition, if we keep the capture rate, but  lower the display rate by ditching frames once in a while (using the following method for example):

 

while (status == 0) {

 

       /* grab a fresh video input frame */

       FVID_exchange(capChan, &frameBuffPtr);

 

      If(frmCnt % 5)

      {                                                    

                /* display the video frame */

               FVID_exchange(disChan, &frameBuffPtr);   

      }

 

     frmCnt ++;

 

}

 

Everything works fine so far.

 

In our application, we are trying to capture in 25 fps (720x576 PAL), and display at (about) 20 fps (720x576 PAL).

In order to achieve this, we created the following task:

Creation code:

 

tskAttrs_50ms_disp = TSK_ATTRS;

               tskAttrs_50ms_disp.priority  = 8;

               tskAttrs_50ms_disp.stacksize = 2048;

               tskAttrs_50ms_disp.name      = "Tsk50ms_disp";

               LOCAL_hTsk_50ms_disp = TSK_create((Fxn)Tsk50ms_disp, &tskAttrs_50ms_disp, NULL);

               status = (LOCAL_hTsk_50ms_disp == NULL ? -1 : 0);

 

Task function code:

 

void Tsk50ms_disp()

{

    FVID_Frame *frameBuffPtr = NULL;

  

    FVID_dequeue(disChan, &frameBuffPtr);

   

    while(1)

    {

               TSK_sleep(50);

               busyIdx = readyIdx;

               memcpy(frameBuffPtr->frame.pFrm.y, IntermFifo[busyIdx], 720*576*2);

               busyIdx = FIFO_SIZE;

               FVID_exchange(disChan, &frameBuffPtr);

    }

}

 

We also modified the video_preview task infinite loop as follows:

 

while (status == 0) {

 

       /* grab a fresh video input frame */

       FVID_exchange(capChan, &frameBuffPtr);

                 

                  readyIdx ++;

 

                  if(readyIdx == FIFO_SIZE)

                  {

                                             readyIdx = 0;

                  }

                  if(readyIdx == busyIdx)

                  {

                                             readyIdx ++;

                  }

                  if(readyIdx == FIFO_SIZE)

                  {

                                             readyIdx = 0;

                  }

                 

                  memcpy(IntermFifo[readyIdx], frameBuffPtr->frame.pFrm.y, 720*576*2);

}

 

So that the display task receives the video data asynchronously by copying it from a place shared by the capture task and the display task.

 

 The problem is this:

 

This scheme runs ok for only a few seconds.

Then, the display task hangs, and after a few seconds the software crashes.

 

Any idea why this happens?

 

Your advice is greatly appreciated!

 

Thanks,

 

Avi.