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.

Multiple video streams problem on DM648

Other Parts Discussed in Thread: TVP5150AM1, TVP5154, TVP5150

Hi,

I am writing an application for DM648. This application should collect video from up to 4 NTSC video cameras to a single NTSC output video stream. I use BIOS VPORT driver do work with video. I wrote a driver for TVP5150AM1 those we use to convert NTSC to BT656 format.

Here is my problem - when I use 3 video cameras - program works fine for the first 1-2 minutes and then stops working. On the screen I can see scrambled video and JTAG stops working at all so I can not check what happened inside DSP.

To simplify a problem I took video-preview example and simply added another 2 capture channels to the this example and replaced driver/calls from TVP5154 to TVP5150 . This example fails the same way as my application.

- Should I initialize EDMA somehow different to work with 5 video streams at the same time?

- Could it be so that TVP5150 sends some corrupted data to the video port and this data fail EDMA?

- I am 99% sure that error cause is EDMA writeing video frame to wrong location. How debug EDMA inside the driver (any document)?

- Could it be so that errata "Advisory 1.1.3 Multiple Master Writes Might Corrupt Data" applicable to the read to video port as well?

 

 

  • Hi,

    Sorry for the delayed response!!

     

    I am assuming you are using TI's PSP VPORT driver.

    To dig this problem could you answer the following:

    1. Which version of PSP driver are you using?

    2. How are you connecting the 4 video to DM648 - which VPORTs are you using?

    3. Could you share the driver configuration?

     

    These will give me some insight in to the problem.

     

    Regards,

    Sivaraj R

  • 1. I use TI's PSP VPORT driver version pspdrivers_1_10_00 from dvsdk_1_11_00_00_DM648.

    2. Four TVP5150AM1 convert NTSC to BT656 format. These BT656 streams come to VPORT0 A and B and VPORT1 A and B. I use VPORT2  to send composed video to video-port of DaVinci DM6446 processor.

    3.What do you mean "driver configuration"? Below is a source code of minimal version (built from VPORT exapmle) that does not work (VPORTx_init is ommited)

    /*
     *  Copyright 2008 by Texas Instruments Incorporated.
     *  All rights reserved. Property of Texas Instruments Incorporated.
     *  Restricted rights to use, duplicate or disclose this code are
     *  granted through contract.
     *
     *  @(#) dvsdk_1_11_00_00 1.11.00.00 061808 (biosdvsdk-c00x)
     */
    /*
     * ======== video_preview.c ========
     *
     */

    #include "51xx/tvp51xx.h"

    #define CAP_PARAMS_PORT_5150(enableDualChan) {                          \
        enableDualChan,             /* enableDualChan                  */   \
        VPORT_POLARITY_ACTIVE_HIGH, /* vport control pin 1 polarity    */   \
        VPORT_POLARITY_ACTIVE_HIGH, /* vport control pin 2 polarity    */   \
        VPORT_POLARITY_ACTIVE_HIGH, /* vport control pin 3 polarity    */   \
        &TVP5150_Fxns,                                                      \
        &TVP5150_Fxns,                                                      \
    }

    /* Video Port configuration parameters for Capture.*/
    VPORT_PortParams vCapParamsPort = CAP_PARAMS_PORT_5150(TRUE);

    /* Video Port configuration parameters for display.*/
    VPORT_PortParams vDisParamsPort = DIS_PARAMS_PORT_RAW_DEFAULT;

    /* Vport Capture driver configuration. Using embedded sync. */
    static VPORTCAP_Params vCapParamsChan  = CAP_PARAMS_CHAN_BT656_DEFAULT(NTSC);

    #define CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(mode, afmt) {               \
        TVP5150_MODE_##mode##,              /* Mode            */           \
        TVP5150_AFMT_##afmt##,              /* Analog format   */           \
        TRUE                                /* enableBT656Sync */           \
    }
    /* TVP5150 EDC driver configuration.
       Using embedded sync and Composite Analog Channel A for all 8 decoders. */
    static TVP5150_ConfParams vCapParamsTVP51XX[MAX_CAP_CHAN] = {
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A),
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A),
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A),
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A),
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A),
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A),
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A),
        CAP_PARAMS_TVP5150_EMBEDDED_DEFAULT(NTSC,COMPOSITE_A)
    };

    /* Vport Display driver configuration.  Using embedded sync. */
    static VPORTDIS_Params vDisParamsChan = DIS_PARAMS_CHAN_BT656_DEFAULT(NTSC);

    /* heap ID defined in the BIOS configuration file */
    extern Int DDR2;

    /* EDMA3 handle: set as side-effect of calling edma3init() */
    extern EDMA3_DRV_Handle hEdma;
    /* Defined in an edma3drv "sample" library */
    extern EDMA3_DRV_Result edma3init();

    /* Number frame buffers per driver */
    #define FRAME_BUFF_CNT 3

    /*
     * ======== main ========
     */
    void main() {
        EDMA3_DRV_Result    result = EDMA3_DRV_SOK;
        /* SOC level and EVM level muxing and configuration code will come here */
        result = edma3init();
        if(EDMA3_DRV_SOK != result)
        {
            printf("Can't initialized EDMA3\n");
            fflush(stdout);
            exit(0);
        }
        return;
    }

    /*
     * ======== video_preview ========
     */
    void video_preview(void) {
        FVID_Frame *frameBuffPtr = NULL;
        FVID_Frame *frameBuffPtr1 = NULL;
        FVID_Frame *frameBuffPtr2 = NULL;

        FVID_Handle disChan, capChan, capChan1, capChan2;

        int status = 0;
        int i;

        /* Assign EDMA driver handle to channel params */
        vCapParamsChan.hEdma = hEdma;
        vDisParamsChan.hEdma = hEdma;

        /* allocate both capture and display frame buffers in external heap */
        vCapParamsChan.segId = DDR2;
        vDisParamsChan.segId = DDR2;

        /*
         * Setting num frame buffers to zero signals the video drivers to allow
         * the application to own the buffers.
         */
        vCapParamsChan.numFrmBufs = 0;
        vDisParamsChan.numFrmBufs = 0;

        /* create video input channel */
        if (status == 0) {
          capChan = FVID_create("/VP0CAPTURE/A/0", /* VP0, Channel A, External Decoder 0 */
                  IOM_INPUT, &status, (Ptr)&vCapParamsChan, NULL);
        }
        /* create video input channel */
        if (status == 0) {
          capChan1 = FVID_create("/VP0CAPTURE/B/1", /* VP0, Channel B, External Decoder 1 */
                  IOM_INPUT, &status, (Ptr)&vCapParamsChan, NULL);
        }

        if (status == 0) {
          capChan2 = FVID_create("/VP1CAPTURE/A/2", /* VP1, Channel A, External Decoder 2 */
                  IOM_INPUT, &status, (Ptr)&vCapParamsChan, NULL);
        }

        /* create video output channel, plane 0 */
        if (status == 0) {
          disChan = FVID_create("/VP2DISPLAY", IOM_OUTPUT, /* VP2, External Encoder 0 */
              &status, (Ptr)&vDisParamsChan, NULL);
        }

        /* allocate and prime frame buffers for the capture channel 0 */
        if (status == 0) {
          for (i=0; i < FRAME_BUFF_CNT && status == 0; i++) {
            status = FVID_allocBuffer(capChan, &frameBuffPtr);
            if (status == IOM_COMPLETED)  {
                status = FVID_queue(capChan, &frameBuffPtr);           
            }
          }
        }
       
        /* allocate and prime frame buffers for the capture channel 1 */
        if (status == 0) {
          for (i=0; i < FRAME_BUFF_CNT && status == 0; i++) {
            status = FVID_allocBuffer(capChan1, &frameBuffPtr1);
            if (status == IOM_COMPLETED)  {
                status = FVID_queue(capChan1, &frameBuffPtr1);           
            }
          }
        }

        /* allocate and prime frame buffers for the capture channel 0 */
        if (status == 0) {
          for (i=0; i < FRAME_BUFF_CNT && status == 0; i++) {
            status = FVID_allocBuffer(capChan2, &frameBuffPtr2);
            if (status == IOM_COMPLETED)  {
                status = FVID_queue(capChan2, &frameBuffPtr2);           
            }
          }
        }

        /* allocate and prime frame buffers for the display channel */
        if (status == 0) {
          for (i=0; i < FRAME_BUFF_CNT && status == 0; i++) {
            status = FVID_allocBuffer(disChan, &frameBuffPtr);
            if (status == IOM_COMPLETED)  {
                status = FVID_queue(disChan, &frameBuffPtr);           
            }
          }
        }

        /* configure the TVP5150 video decoder */
        if (status == 0) {

          /* configure video encoder & decoder                  */
    //       FVID_control(disChan, VPORT_CMD_EDC_BASE + EDC_CONFIG,
    //          (Ptr)&vDisParamsSAA7105);

           status = FVID_control(capChan, VPORT_CMD_EDC_BASE + EDC_CONFIG,
              (Ptr)&vCapParamsTVP51XX[0]);

           status = FVID_control(capChan1, VPORT_CMD_EDC_BASE + EDC_CONFIG,
              (Ptr)&vCapParamsTVP51XX[1]);

           status = FVID_control(capChan2, VPORT_CMD_EDC_BASE + EDC_CONFIG,
              (Ptr)&vCapParamsTVP51XX[2]);

           /* start capture & display operation                  */
           FVID_control(disChan,  VPORT_CMD_START, NULL);
           status = FVID_control(capChan,  VPORT_CMD_START, NULL);
           status = FVID_control(capChan1, VPORT_CMD_START, NULL);
           status = FVID_control(capChan2, VPORT_CMD_START, NULL);
        }

        /* grab first buffer from input queue */
        if (status == 0) {
           FVID_dequeue(disChan, &frameBuffPtr);      
           FVID_dequeue(capChan1, &frameBuffPtr1);
           FVID_dequeue(capChan2, &frameBuffPtr2);      
        }

        /* loop forever performing video capture and display */
        while (status == 0)
        {
           /* grab a fresh video input frame */
           FVID_exchange(capChan, &frameBuffPtr);
           FVID_exchange(capChan1, &frameBuffPtr1);
           FVID_exchange(capChan2, &frameBuffPtr2);
           /* display the video frame */
           FVID_exchange(disChan, &frameBuffPtr);
        }
    }

  • Hi,

    Since you are using VP0 and VP1 for capture and VP2 for display, you have to change the EDMA TC used to transfer data to the VPORTs.

    The current PSP driver uses TC2 for VP0, VP2, VP3 and VP4 (for both channel A and B for all the ports). And uses TC3 for VP1. This is based on the EVM layout in which VP0, VP2, VP3 and VP4 are used for capture and VP1 is used for display.

    You can do so by doing the following:

    1. The TC allocation is part of the file _vport.h in “pspdrivers_1_10_01\packages\ti\sdo\pspdrivers\drivers\vport\src”.

    2. Change the macros EDMA_CHA_VP0EVTQA and similar ones to the desired TC number.

    3.You have to recompile the VPORT driver after this.

    Let me know if this solves your problem.

     

    Regards,

    Sivaraj R

  • Sivaraj,

    Thank you. It works just fine